id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,700 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.isGetter | public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter() {
return takesArguments(0).and(not(returns(TypeDescription.VOID))).and(nameStartsWith("get").or(nameStartsWith("is").and(returnsGeneric(anyOf(boolean.class, Boolean.class)))));
} | java | public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter() {
return takesArguments(0).and(not(returns(TypeDescription.VOID))).and(nameStartsWith("get").or(nameStartsWith("is").and(returnsGeneric(anyOf(boolean.class, Boolean.class)))));
} | [
"public",
"static",
"<",
"T",
"extends",
"MethodDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"isGetter",
"(",
")",
"{",
"return",
"takesArguments",
"(",
"0",
")",
".",
"and",
"(",
"not",
"(",
"returns",
"(",
"TypeDescription",
".",
"VOID",
")",
")",
")",
".",
"and",
"(",
"nameStartsWith",
"(",
"\"get\"",
")",
".",
"or",
"(",
"nameStartsWith",
"(",
"\"is\"",
")",
".",
"and",
"(",
"returnsGeneric",
"(",
"anyOf",
"(",
"boolean",
".",
"class",
",",
"Boolean",
".",
"class",
")",
")",
")",
")",
")",
";",
"}"
] | Matches any Java bean getter method.
@param <T> The type of the matched object.
@return A matcher that matches any getter method. | [
"Matches",
"any",
"Java",
"bean",
"getter",
"method",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1737-L1739 |
22,701 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.hasMethodName | public static <T extends MethodDescription> ElementMatcher.Junction<T> hasMethodName(String internalName) {
if (MethodDescription.CONSTRUCTOR_INTERNAL_NAME.equals(internalName)) {
return isConstructor();
} else if (MethodDescription.TYPE_INITIALIZER_INTERNAL_NAME.equals(internalName)) {
return isTypeInitializer();
} else {
return named(internalName);
}
} | java | public static <T extends MethodDescription> ElementMatcher.Junction<T> hasMethodName(String internalName) {
if (MethodDescription.CONSTRUCTOR_INTERNAL_NAME.equals(internalName)) {
return isConstructor();
} else if (MethodDescription.TYPE_INITIALIZER_INTERNAL_NAME.equals(internalName)) {
return isTypeInitializer();
} else {
return named(internalName);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"MethodDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"hasMethodName",
"(",
"String",
"internalName",
")",
"{",
"if",
"(",
"MethodDescription",
".",
"CONSTRUCTOR_INTERNAL_NAME",
".",
"equals",
"(",
"internalName",
")",
")",
"{",
"return",
"isConstructor",
"(",
")",
";",
"}",
"else",
"if",
"(",
"MethodDescription",
".",
"TYPE_INITIALIZER_INTERNAL_NAME",
".",
"equals",
"(",
"internalName",
")",
")",
"{",
"return",
"isTypeInitializer",
"(",
")",
";",
"}",
"else",
"{",
"return",
"named",
"(",
"internalName",
")",
";",
"}",
"}"
] | Matches a method against its internal name such that constructors and type initializers are matched appropriately.
@param internalName The internal name of the method.
@param <T> The type of the matched object.
@return A matcher for a method with the provided internal name. | [
"Matches",
"a",
"method",
"against",
"its",
"internal",
"name",
"such",
"that",
"constructors",
"and",
"type",
"initializers",
"are",
"matched",
"appropriately",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1829-L1837 |
22,702 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.hasSignature | public static <T extends MethodDescription> ElementMatcher.Junction<T> hasSignature(MethodDescription.SignatureToken token) {
return new SignatureTokenMatcher<T>(is(token));
} | java | public static <T extends MethodDescription> ElementMatcher.Junction<T> hasSignature(MethodDescription.SignatureToken token) {
return new SignatureTokenMatcher<T>(is(token));
} | [
"public",
"static",
"<",
"T",
"extends",
"MethodDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"hasSignature",
"(",
"MethodDescription",
".",
"SignatureToken",
"token",
")",
"{",
"return",
"new",
"SignatureTokenMatcher",
"<",
"T",
">",
"(",
"is",
"(",
"token",
")",
")",
";",
"}"
] | Only matches method descriptions that yield the provided signature token.
@param token The signature token to match against.
@param <T> The type of the matched object.
@return A matcher for a method with the provided signature token. | [
"Only",
"matches",
"method",
"descriptions",
"that",
"yield",
"the",
"provided",
"signature",
"token",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1846-L1848 |
22,703 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.isSubTypeOf | public static <T extends TypeDescription> ElementMatcher.Junction<T> isSubTypeOf(TypeDescription type) {
return new SubTypeMatcher<T>(type);
} | java | public static <T extends TypeDescription> ElementMatcher.Junction<T> isSubTypeOf(TypeDescription type) {
return new SubTypeMatcher<T>(type);
} | [
"public",
"static",
"<",
"T",
"extends",
"TypeDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"isSubTypeOf",
"(",
"TypeDescription",
"type",
")",
"{",
"return",
"new",
"SubTypeMatcher",
"<",
"T",
">",
"(",
"type",
")",
";",
"}"
] | Matches any type description that is a subtype of the given type.
@param type The type to be checked for being a subtype of the matched type.
@param <T> The type of the matched object.
@return A matcher that matches any type description that represents a sub type of the given type. | [
"Matches",
"any",
"type",
"description",
"that",
"is",
"a",
"subtype",
"of",
"the",
"given",
"type",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1868-L1870 |
22,704 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.inheritsAnnotation | public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(TypeDescription type) {
return inheritsAnnotation(is(type));
} | java | public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(TypeDescription type) {
return inheritsAnnotation(is(type));
} | [
"public",
"static",
"<",
"T",
"extends",
"TypeDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"inheritsAnnotation",
"(",
"TypeDescription",
"type",
")",
"{",
"return",
"inheritsAnnotation",
"(",
"is",
"(",
"type",
")",
")",
";",
"}"
] | Matches any annotations by their type on a type that declared these annotations or inherited them from its
super classes.
@param type The annotation type to be matched.
@param <T> The type of the matched object.
@return A matcher that matches any inherited annotation by their type. | [
"Matches",
"any",
"annotations",
"by",
"their",
"type",
"on",
"a",
"type",
"that",
"declared",
"these",
"annotations",
"or",
"inherited",
"them",
"from",
"its",
"super",
"classes",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1936-L1938 |
22,705 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.inheritsAnnotation | public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(ElementMatcher<? super TypeDescription> matcher) {
return hasAnnotation(annotationType(matcher));
} | java | public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(ElementMatcher<? super TypeDescription> matcher) {
return hasAnnotation(annotationType(matcher));
} | [
"public",
"static",
"<",
"T",
"extends",
"TypeDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"inheritsAnnotation",
"(",
"ElementMatcher",
"<",
"?",
"super",
"TypeDescription",
">",
"matcher",
")",
"{",
"return",
"hasAnnotation",
"(",
"annotationType",
"(",
"matcher",
")",
")",
";",
"}"
] | Matches any annotations by a given matcher on a type that declared these annotations or inherited them from its
super classes.
@param matcher A matcher to apply onto the inherited annotations.
@param <T> The type of the matched object.
@return A matcher that matches any inherited annotation by a given matcher. | [
"Matches",
"any",
"annotations",
"by",
"a",
"given",
"matcher",
"on",
"a",
"type",
"that",
"declared",
"these",
"annotations",
"or",
"inherited",
"them",
"from",
"its",
"super",
"classes",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1948-L1950 |
22,706 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.hasAnnotation | public static <T extends TypeDescription> ElementMatcher.Junction<T> hasAnnotation(ElementMatcher<? super AnnotationDescription> matcher) {
return new InheritedAnnotationMatcher<T>(new CollectionItemMatcher<AnnotationDescription>(matcher));
} | java | public static <T extends TypeDescription> ElementMatcher.Junction<T> hasAnnotation(ElementMatcher<? super AnnotationDescription> matcher) {
return new InheritedAnnotationMatcher<T>(new CollectionItemMatcher<AnnotationDescription>(matcher));
} | [
"public",
"static",
"<",
"T",
"extends",
"TypeDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"hasAnnotation",
"(",
"ElementMatcher",
"<",
"?",
"super",
"AnnotationDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"InheritedAnnotationMatcher",
"<",
"T",
">",
"(",
"new",
"CollectionItemMatcher",
"<",
"AnnotationDescription",
">",
"(",
"matcher",
")",
")",
";",
"}"
] | Matches a list of annotations by a given matcher on a type that declared these annotations or inherited them
from its super classes.
@param matcher A matcher to apply onto a list of inherited annotations.
@param <T> The type of the matched object.
@return A matcher that matches a list of inherited annotation by a given matcher. | [
"Matches",
"a",
"list",
"of",
"annotations",
"by",
"a",
"given",
"matcher",
"on",
"a",
"type",
"that",
"declared",
"these",
"annotations",
"or",
"inherited",
"them",
"from",
"its",
"super",
"classes",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1960-L1962 |
22,707 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.declaresField | public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresField(ElementMatcher<? super FieldDescription> matcher) {
return new DeclaringFieldMatcher<T>(new CollectionItemMatcher<FieldDescription>(matcher));
} | java | public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresField(ElementMatcher<? super FieldDescription> matcher) {
return new DeclaringFieldMatcher<T>(new CollectionItemMatcher<FieldDescription>(matcher));
} | [
"public",
"static",
"<",
"T",
"extends",
"TypeDefinition",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"declaresField",
"(",
"ElementMatcher",
"<",
"?",
"super",
"FieldDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"DeclaringFieldMatcher",
"<",
"T",
">",
"(",
"new",
"CollectionItemMatcher",
"<",
"FieldDescription",
">",
"(",
"matcher",
")",
")",
";",
"}"
] | Matches a type by a another matcher that is applied on any of its declared fields.
@param matcher The matcher that is applied onto each declared field.
@param <T> The type of the matched object.
@return A matcher that matches any type where another matcher is matched positively on at least on declared field. | [
"Matches",
"a",
"type",
"by",
"a",
"another",
"matcher",
"that",
"is",
"applied",
"on",
"any",
"of",
"its",
"declared",
"fields",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1971-L1973 |
22,708 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.declaresMethod | public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresMethod(ElementMatcher<? super MethodDescription> matcher) {
return new DeclaringMethodMatcher<T>(new CollectionItemMatcher<MethodDescription>(matcher));
} | java | public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresMethod(ElementMatcher<? super MethodDescription> matcher) {
return new DeclaringMethodMatcher<T>(new CollectionItemMatcher<MethodDescription>(matcher));
} | [
"public",
"static",
"<",
"T",
"extends",
"TypeDefinition",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"declaresMethod",
"(",
"ElementMatcher",
"<",
"?",
"super",
"MethodDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"DeclaringMethodMatcher",
"<",
"T",
">",
"(",
"new",
"CollectionItemMatcher",
"<",
"MethodDescription",
">",
"(",
"matcher",
")",
")",
";",
"}"
] | Matches a type by a another matcher that is applied on any of its declared methods.
@param matcher The matcher that is applied onto each declared method.
@param <T> The type of the matched object.
@return A matcher that matches any type where another matcher is matched positively on at least on declared methods. | [
"Matches",
"a",
"type",
"by",
"a",
"another",
"matcher",
"that",
"is",
"applied",
"on",
"any",
"of",
"its",
"declared",
"methods",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1982-L1984 |
22,709 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.annotationType | public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(ElementMatcher<? super TypeDescription> matcher) {
return new AnnotationTypeMatcher<T>(matcher);
} | java | public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(ElementMatcher<? super TypeDescription> matcher) {
return new AnnotationTypeMatcher<T>(matcher);
} | [
"public",
"static",
"<",
"T",
"extends",
"AnnotationDescription",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"annotationType",
"(",
"ElementMatcher",
"<",
"?",
"super",
"TypeDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"AnnotationTypeMatcher",
"<",
"T",
">",
"(",
"matcher",
")",
";",
"}"
] | Matches if an annotation's type matches the supplied matcher.
@param matcher The matcher to match the annotation's type against.
@param <T> The type of the matched object.
@return A matcher that matches the annotation's type. | [
"Matches",
"if",
"an",
"annotation",
"s",
"type",
"matches",
"the",
"supplied",
"matcher",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L2143-L2145 |
22,710 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.isChildOf | public static <T extends ClassLoader> ElementMatcher.Junction<T> isChildOf(ClassLoader classLoader) {
return classLoader == BOOTSTRAP_CLASSLOADER
? new BooleanMatcher<T>(true)
: ElementMatchers.<T>hasChild(is(classLoader));
} | java | public static <T extends ClassLoader> ElementMatcher.Junction<T> isChildOf(ClassLoader classLoader) {
return classLoader == BOOTSTRAP_CLASSLOADER
? new BooleanMatcher<T>(true)
: ElementMatchers.<T>hasChild(is(classLoader));
} | [
"public",
"static",
"<",
"T",
"extends",
"ClassLoader",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"isChildOf",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"classLoader",
"==",
"BOOTSTRAP_CLASSLOADER",
"?",
"new",
"BooleanMatcher",
"<",
"T",
">",
"(",
"true",
")",
":",
"ElementMatchers",
".",
"<",
"T",
">",
"hasChild",
"(",
"is",
"(",
"classLoader",
")",
")",
";",
"}"
] | Matches any class loader that is either the given class loader or a child of the given class loader.
@param classLoader The class loader of which child class loaders are matched.
@param <T> The type of the matched object.
@return A matcher that matches the given class loader and any class loader that is a child of the given
class loader. | [
"Matches",
"any",
"class",
"loader",
"that",
"is",
"either",
"the",
"given",
"class",
"loader",
"or",
"a",
"child",
"of",
"the",
"given",
"class",
"loader",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L2191-L2195 |
22,711 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.hasChild | public static <T extends ClassLoader> ElementMatcher.Junction<T> hasChild(ElementMatcher<? super ClassLoader> matcher) {
return new ClassLoaderHierarchyMatcher<T>(matcher);
} | java | public static <T extends ClassLoader> ElementMatcher.Junction<T> hasChild(ElementMatcher<? super ClassLoader> matcher) {
return new ClassLoaderHierarchyMatcher<T>(matcher);
} | [
"public",
"static",
"<",
"T",
"extends",
"ClassLoader",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"hasChild",
"(",
"ElementMatcher",
"<",
"?",
"super",
"ClassLoader",
">",
"matcher",
")",
"{",
"return",
"new",
"ClassLoaderHierarchyMatcher",
"<",
"T",
">",
"(",
"matcher",
")",
";",
"}"
] | Matches all class loaders in the hierarchy of the matched class loader against a given matcher.
@param matcher The matcher to apply to all class loaders in the hierarchy of the matched class loader.
@param <T> The type of the matched object.
@return A matcher that matches all class loaders in the hierarchy of the matched class loader. | [
"Matches",
"all",
"class",
"loaders",
"in",
"the",
"hierarchy",
"of",
"the",
"matched",
"class",
"loader",
"against",
"a",
"given",
"matcher",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L2204-L2206 |
22,712 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.isParentOf | public static <T extends ClassLoader> ElementMatcher.Junction<T> isParentOf(ClassLoader classLoader) {
return classLoader == BOOTSTRAP_CLASSLOADER
? ElementMatchers.<T>isBootstrapClassLoader()
: new ClassLoaderParentMatcher<T>(classLoader);
} | java | public static <T extends ClassLoader> ElementMatcher.Junction<T> isParentOf(ClassLoader classLoader) {
return classLoader == BOOTSTRAP_CLASSLOADER
? ElementMatchers.<T>isBootstrapClassLoader()
: new ClassLoaderParentMatcher<T>(classLoader);
} | [
"public",
"static",
"<",
"T",
"extends",
"ClassLoader",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"isParentOf",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"classLoader",
"==",
"BOOTSTRAP_CLASSLOADER",
"?",
"ElementMatchers",
".",
"<",
"T",
">",
"isBootstrapClassLoader",
"(",
")",
":",
"new",
"ClassLoaderParentMatcher",
"<",
"T",
">",
"(",
"classLoader",
")",
";",
"}"
] | Matches any class loader that is either the given class loader or a parent of the given class loader.
@param classLoader The class loader of which parent class loaders are matched.
@param <T> The type of the matched object.
@return A matcher that matches the given class loader and any class loader that is a parent of the given
class loader. | [
"Matches",
"any",
"class",
"loader",
"that",
"is",
"either",
"the",
"given",
"class",
"loader",
"or",
"a",
"parent",
"of",
"the",
"given",
"class",
"loader",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L2216-L2220 |
22,713 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.ofType | public static <T extends ClassLoader> ElementMatcher.Junction<T> ofType(ElementMatcher<? super TypeDescription> matcher) {
return new InstanceTypeMatcher<T>(matcher);
} | java | public static <T extends ClassLoader> ElementMatcher.Junction<T> ofType(ElementMatcher<? super TypeDescription> matcher) {
return new InstanceTypeMatcher<T>(matcher);
} | [
"public",
"static",
"<",
"T",
"extends",
"ClassLoader",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"ofType",
"(",
"ElementMatcher",
"<",
"?",
"super",
"TypeDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"InstanceTypeMatcher",
"<",
"T",
">",
"(",
"matcher",
")",
";",
"}"
] | Matches a class loader's type unless it is the bootstrap class loader which is never matched.
@param matcher The matcher to apply to the class loader's type.
@param <T> The type of the matched object.
@return A matcher that matches the class loader's type. | [
"Matches",
"a",
"class",
"loader",
"s",
"type",
"unless",
"it",
"is",
"the",
"bootstrap",
"class",
"loader",
"which",
"is",
"never",
"matched",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L2229-L2231 |
22,714 | raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java | ByteBuddyMojo.findJavaVersionString | private static String findJavaVersionString(MavenProject project) {
while (project != null) {
String target = project.getProperties().getProperty("maven.compiler.target");
if (target != null) {
return target;
}
for (org.apache.maven.model.Plugin plugin : CompoundList.of(project.getBuildPlugins(), project.getPluginManagement().getPlugins())) {
if ("maven-compiler-plugin".equals(plugin.getArtifactId())) {
if (plugin.getConfiguration() instanceof Xpp3Dom) {
Xpp3Dom node = ((Xpp3Dom) plugin.getConfiguration()).getChild("target");
if (node != null) {
return node.getValue();
}
}
}
}
project = project.getParent();
}
return null;
} | java | private static String findJavaVersionString(MavenProject project) {
while (project != null) {
String target = project.getProperties().getProperty("maven.compiler.target");
if (target != null) {
return target;
}
for (org.apache.maven.model.Plugin plugin : CompoundList.of(project.getBuildPlugins(), project.getPluginManagement().getPlugins())) {
if ("maven-compiler-plugin".equals(plugin.getArtifactId())) {
if (plugin.getConfiguration() instanceof Xpp3Dom) {
Xpp3Dom node = ((Xpp3Dom) plugin.getConfiguration()).getChild("target");
if (node != null) {
return node.getValue();
}
}
}
}
project = project.getParent();
}
return null;
} | [
"private",
"static",
"String",
"findJavaVersionString",
"(",
"MavenProject",
"project",
")",
"{",
"while",
"(",
"project",
"!=",
"null",
")",
"{",
"String",
"target",
"=",
"project",
".",
"getProperties",
"(",
")",
".",
"getProperty",
"(",
"\"maven.compiler.target\"",
")",
";",
"if",
"(",
"target",
"!=",
"null",
")",
"{",
"return",
"target",
";",
"}",
"for",
"(",
"org",
".",
"apache",
".",
"maven",
".",
"model",
".",
"Plugin",
"plugin",
":",
"CompoundList",
".",
"of",
"(",
"project",
".",
"getBuildPlugins",
"(",
")",
",",
"project",
".",
"getPluginManagement",
"(",
")",
".",
"getPlugins",
"(",
")",
")",
")",
"{",
"if",
"(",
"\"maven-compiler-plugin\"",
".",
"equals",
"(",
"plugin",
".",
"getArtifactId",
"(",
")",
")",
")",
"{",
"if",
"(",
"plugin",
".",
"getConfiguration",
"(",
")",
"instanceof",
"Xpp3Dom",
")",
"{",
"Xpp3Dom",
"node",
"=",
"(",
"(",
"Xpp3Dom",
")",
"plugin",
".",
"getConfiguration",
"(",
")",
")",
".",
"getChild",
"(",
"\"target\"",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"return",
"node",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"}",
"}",
"project",
"=",
"project",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Makes a best effort of locating the configured Java target version.
@param project The relevant Maven project.
@return The Java version string of the configured build target version or {@code null} if no explicit configuration was detected. | [
"Makes",
"a",
"best",
"effort",
"of",
"locating",
"the",
"configured",
"Java",
"target",
"version",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java#L322-L341 |
22,715 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/auxiliary/MethodCallProxy.java | MethodCallProxy.extractFields | private static LinkedHashMap<String, TypeDescription> extractFields(MethodDescription methodDescription) {
LinkedHashMap<String, TypeDescription> typeDescriptions = new LinkedHashMap<String, TypeDescription>();
int currentIndex = 0;
if (!methodDescription.isStatic()) {
typeDescriptions.put(fieldName(currentIndex++), methodDescription.getDeclaringType().asErasure());
}
for (ParameterDescription parameterDescription : methodDescription.getParameters()) {
typeDescriptions.put(fieldName(currentIndex++), parameterDescription.getType().asErasure());
}
return typeDescriptions;
} | java | private static LinkedHashMap<String, TypeDescription> extractFields(MethodDescription methodDescription) {
LinkedHashMap<String, TypeDescription> typeDescriptions = new LinkedHashMap<String, TypeDescription>();
int currentIndex = 0;
if (!methodDescription.isStatic()) {
typeDescriptions.put(fieldName(currentIndex++), methodDescription.getDeclaringType().asErasure());
}
for (ParameterDescription parameterDescription : methodDescription.getParameters()) {
typeDescriptions.put(fieldName(currentIndex++), parameterDescription.getType().asErasure());
}
return typeDescriptions;
} | [
"private",
"static",
"LinkedHashMap",
"<",
"String",
",",
"TypeDescription",
">",
"extractFields",
"(",
"MethodDescription",
"methodDescription",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"TypeDescription",
">",
"typeDescriptions",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"TypeDescription",
">",
"(",
")",
";",
"int",
"currentIndex",
"=",
"0",
";",
"if",
"(",
"!",
"methodDescription",
".",
"isStatic",
"(",
")",
")",
"{",
"typeDescriptions",
".",
"put",
"(",
"fieldName",
"(",
"currentIndex",
"++",
")",
",",
"methodDescription",
".",
"getDeclaringType",
"(",
")",
".",
"asErasure",
"(",
")",
")",
";",
"}",
"for",
"(",
"ParameterDescription",
"parameterDescription",
":",
"methodDescription",
".",
"getParameters",
"(",
")",
")",
"{",
"typeDescriptions",
".",
"put",
"(",
"fieldName",
"(",
"currentIndex",
"++",
")",
",",
"parameterDescription",
".",
"getType",
"(",
")",
".",
"asErasure",
"(",
")",
")",
";",
"}",
"return",
"typeDescriptions",
";",
"}"
] | Creates a linked hash map of field names to their types where each field represents a parameter of the method.
@param methodDescription The method to extract into fields.
@return A map of fields in the order they need to be loaded onto the operand stack for invoking the original
method, including a reference to the instance of the instrumented type that is invoked if applicable. | [
"Creates",
"a",
"linked",
"hash",
"map",
"of",
"field",
"names",
"to",
"their",
"types",
"where",
"each",
"field",
"represents",
"a",
"parameter",
"of",
"the",
"method",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/auxiliary/MethodCallProxy.java#L126-L136 |
22,716 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeVariableToken.java | TypeVariableToken.of | public static TypeVariableToken of(TypeDescription.Generic typeVariable, ElementMatcher<? super TypeDescription> matcher) {
return new TypeVariableToken(typeVariable.getSymbol(),
typeVariable.getUpperBounds().accept(new TypeDescription.Generic.Visitor.Substitutor.ForDetachment(matcher)),
typeVariable.getDeclaredAnnotations());
} | java | public static TypeVariableToken of(TypeDescription.Generic typeVariable, ElementMatcher<? super TypeDescription> matcher) {
return new TypeVariableToken(typeVariable.getSymbol(),
typeVariable.getUpperBounds().accept(new TypeDescription.Generic.Visitor.Substitutor.ForDetachment(matcher)),
typeVariable.getDeclaredAnnotations());
} | [
"public",
"static",
"TypeVariableToken",
"of",
"(",
"TypeDescription",
".",
"Generic",
"typeVariable",
",",
"ElementMatcher",
"<",
"?",
"super",
"TypeDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"TypeVariableToken",
"(",
"typeVariable",
".",
"getSymbol",
"(",
")",
",",
"typeVariable",
".",
"getUpperBounds",
"(",
")",
".",
"accept",
"(",
"new",
"TypeDescription",
".",
"Generic",
".",
"Visitor",
".",
"Substitutor",
".",
"ForDetachment",
"(",
"matcher",
")",
")",
",",
"typeVariable",
".",
"getDeclaredAnnotations",
"(",
")",
")",
";",
"}"
] | Transforms a type variable into a type variable token with its bounds detached.
@param typeVariable A type variable in its attached state.
@param matcher A matcher that identifies types to detach from the upper bound types.
@return A token representing the detached type variable. | [
"Transforms",
"a",
"type",
"variable",
"into",
"a",
"type",
"variable",
"token",
"with",
"its",
"bounds",
"detached",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeVariableToken.java#L76-L80 |
22,717 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/TypeCasting.java | TypeCasting.to | public static StackManipulation to(TypeDefinition typeDefinition) {
if (typeDefinition.isPrimitive()) {
throw new IllegalArgumentException("Cannot cast to primitive type: " + typeDefinition);
}
return new TypeCasting(typeDefinition.asErasure());
} | java | public static StackManipulation to(TypeDefinition typeDefinition) {
if (typeDefinition.isPrimitive()) {
throw new IllegalArgumentException("Cannot cast to primitive type: " + typeDefinition);
}
return new TypeCasting(typeDefinition.asErasure());
} | [
"public",
"static",
"StackManipulation",
"to",
"(",
"TypeDefinition",
"typeDefinition",
")",
"{",
"if",
"(",
"typeDefinition",
".",
"isPrimitive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot cast to primitive type: \"",
"+",
"typeDefinition",
")",
";",
"}",
"return",
"new",
"TypeCasting",
"(",
"typeDefinition",
".",
"asErasure",
"(",
")",
")",
";",
"}"
] | Creates a casting to the given, non-primitive type.
@param typeDefinition The type to which a value should be casted.
@return A stack manipulation that represents the casting. | [
"Creates",
"a",
"casting",
"to",
"the",
"given",
"non",
"-",
"primitive",
"type",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/TypeCasting.java#L54-L59 |
22,718 | raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Transformation.java | Transformation.argument | public void argument(Closure<?> closure) {
arguments.add((PluginArgument) project.configure(new PluginArgument(), closure));
} | java | public void argument(Closure<?> closure) {
arguments.add((PluginArgument) project.configure(new PluginArgument(), closure));
} | [
"public",
"void",
"argument",
"(",
"Closure",
"<",
"?",
">",
"closure",
")",
"{",
"arguments",
".",
"add",
"(",
"(",
"PluginArgument",
")",
"project",
".",
"configure",
"(",
"new",
"PluginArgument",
"(",
")",
",",
"closure",
")",
")",
";",
"}"
] | Adds a plugin argument to consider during instantiation.
@param closure The closure for configuring the argument. | [
"Adds",
"a",
"plugin",
"argument",
"to",
"consider",
"during",
"instantiation",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Transformation.java#L62-L64 |
22,719 | raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Transformation.java | Transformation.makeArgumentResolvers | public List<Plugin.Factory.UsingReflection.ArgumentResolver> makeArgumentResolvers() {
if (arguments == null) {
return Collections.emptyList();
} else {
List<Plugin.Factory.UsingReflection.ArgumentResolver> argumentResolvers = new ArrayList<Plugin.Factory.UsingReflection.ArgumentResolver>();
for (PluginArgument argument : arguments) {
argumentResolvers.add(argument.toArgumentResolver());
}
return argumentResolvers;
}
} | java | public List<Plugin.Factory.UsingReflection.ArgumentResolver> makeArgumentResolvers() {
if (arguments == null) {
return Collections.emptyList();
} else {
List<Plugin.Factory.UsingReflection.ArgumentResolver> argumentResolvers = new ArrayList<Plugin.Factory.UsingReflection.ArgumentResolver>();
for (PluginArgument argument : arguments) {
argumentResolvers.add(argument.toArgumentResolver());
}
return argumentResolvers;
}
} | [
"public",
"List",
"<",
"Plugin",
".",
"Factory",
".",
"UsingReflection",
".",
"ArgumentResolver",
">",
"makeArgumentResolvers",
"(",
")",
"{",
"if",
"(",
"arguments",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"else",
"{",
"List",
"<",
"Plugin",
".",
"Factory",
".",
"UsingReflection",
".",
"ArgumentResolver",
">",
"argumentResolvers",
"=",
"new",
"ArrayList",
"<",
"Plugin",
".",
"Factory",
".",
"UsingReflection",
".",
"ArgumentResolver",
">",
"(",
")",
";",
"for",
"(",
"PluginArgument",
"argument",
":",
"arguments",
")",
"{",
"argumentResolvers",
".",
"add",
"(",
"argument",
".",
"toArgumentResolver",
"(",
")",
")",
";",
"}",
"return",
"argumentResolvers",
";",
"}",
"}"
] | Creates the argument resolvers for the plugin's constructor by transforming the plugin arguments.
@return A list of argument resolvers. | [
"Creates",
"the",
"argument",
"resolvers",
"for",
"the",
"plugin",
"s",
"constructor",
"by",
"transforming",
"the",
"plugin",
"arguments",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Transformation.java#L101-L111 |
22,720 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/TypeCreation.java | TypeCreation.of | public static StackManipulation of(TypeDescription typeDescription) {
if (typeDescription.isArray() || typeDescription.isPrimitive() || typeDescription.isAbstract()) {
throw new IllegalArgumentException(typeDescription + " is not instantiable");
}
return new TypeCreation(typeDescription);
} | java | public static StackManipulation of(TypeDescription typeDescription) {
if (typeDescription.isArray() || typeDescription.isPrimitive() || typeDescription.isAbstract()) {
throw new IllegalArgumentException(typeDescription + " is not instantiable");
}
return new TypeCreation(typeDescription);
} | [
"public",
"static",
"StackManipulation",
"of",
"(",
"TypeDescription",
"typeDescription",
")",
"{",
"if",
"(",
"typeDescription",
".",
"isArray",
"(",
")",
"||",
"typeDescription",
".",
"isPrimitive",
"(",
")",
"||",
"typeDescription",
".",
"isAbstract",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"typeDescription",
"+",
"\" is not instantiable\"",
")",
";",
"}",
"return",
"new",
"TypeCreation",
"(",
"typeDescription",
")",
";",
"}"
] | Creates a type creation for the given type.
@param typeDescription The type to be create.
@return A stack manipulation that represents the creation of the given type. | [
"Creates",
"a",
"type",
"creation",
"for",
"the",
"given",
"type",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/TypeCreation.java#L50-L55 |
22,721 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/specimen/ExampleClass.java | ExampleClass.method | public Object[] method(Object arg1, Object arg2, Object arg3) {
return new Object[]{arg1, arg2, arg3};
} | java | public Object[] method(Object arg1, Object arg2, Object arg3) {
return new Object[]{arg1, arg2, arg3};
} | [
"public",
"Object",
"[",
"]",
"method",
"(",
"Object",
"arg1",
",",
"Object",
"arg2",
",",
"Object",
"arg3",
")",
"{",
"return",
"new",
"Object",
"[",
"]",
"{",
"arg1",
",",
"arg2",
",",
"arg3",
"}",
";",
"}"
] | An example method.
@param arg1 An argument.
@param arg2 An argument.
@param arg3 An argument.
@return All arguments stored in an array. | [
"An",
"example",
"method",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/specimen/ExampleClass.java#L217-L219 |
22,722 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/MethodOverrideMatcher.java | MethodOverrideMatcher.matches | private boolean matches(MethodDescription target, List<? extends TypeDefinition> typeDefinitions, Set<TypeDescription> duplicates) {
for (TypeDefinition anInterface : typeDefinitions) {
if (duplicates.add(anInterface.asErasure()) && (matches(target, anInterface) || matches(target, anInterface.getInterfaces(), duplicates))) {
return true;
}
}
return false;
} | java | private boolean matches(MethodDescription target, List<? extends TypeDefinition> typeDefinitions, Set<TypeDescription> duplicates) {
for (TypeDefinition anInterface : typeDefinitions) {
if (duplicates.add(anInterface.asErasure()) && (matches(target, anInterface) || matches(target, anInterface.getInterfaces(), duplicates))) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"matches",
"(",
"MethodDescription",
"target",
",",
"List",
"<",
"?",
"extends",
"TypeDefinition",
">",
"typeDefinitions",
",",
"Set",
"<",
"TypeDescription",
">",
"duplicates",
")",
"{",
"for",
"(",
"TypeDefinition",
"anInterface",
":",
"typeDefinitions",
")",
"{",
"if",
"(",
"duplicates",
".",
"add",
"(",
"anInterface",
".",
"asErasure",
"(",
")",
")",
"&&",
"(",
"matches",
"(",
"target",
",",
"anInterface",
")",
"||",
"matches",
"(",
"target",
",",
"anInterface",
".",
"getInterfaces",
"(",
")",
",",
"duplicates",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Matches a method against a list of types.
@param target The method that is matched as a target.
@param typeDefinitions The type definitions to check if they declare a method with the same signature as {@code target}.
@param duplicates A set containing duplicate interfaces that do not need to be revisited.
@return {@code true} if any type defines a method with the same signature as the {@code target} method. | [
"Matches",
"a",
"method",
"against",
"a",
"list",
"of",
"types",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/MethodOverrideMatcher.java#L72-L79 |
22,723 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | MethodHandle.of | public static MethodHandle of(MethodDescription.InDefinedShape methodDescription) {
return new MethodHandle(HandleType.of(methodDescription),
methodDescription.getDeclaringType().asErasure(),
methodDescription.getInternalName(),
methodDescription.getReturnType().asErasure(),
methodDescription.getParameters().asTypeList().asErasures());
} | java | public static MethodHandle of(MethodDescription.InDefinedShape methodDescription) {
return new MethodHandle(HandleType.of(methodDescription),
methodDescription.getDeclaringType().asErasure(),
methodDescription.getInternalName(),
methodDescription.getReturnType().asErasure(),
methodDescription.getParameters().asTypeList().asErasures());
} | [
"public",
"static",
"MethodHandle",
"of",
"(",
"MethodDescription",
".",
"InDefinedShape",
"methodDescription",
")",
"{",
"return",
"new",
"MethodHandle",
"(",
"HandleType",
".",
"of",
"(",
"methodDescription",
")",
",",
"methodDescription",
".",
"getDeclaringType",
"(",
")",
".",
"asErasure",
"(",
")",
",",
"methodDescription",
".",
"getInternalName",
"(",
")",
",",
"methodDescription",
".",
"getReturnType",
"(",
")",
".",
"asErasure",
"(",
")",
",",
"methodDescription",
".",
"getParameters",
"(",
")",
".",
"asTypeList",
"(",
")",
".",
"asErasures",
"(",
")",
")",
";",
"}"
] | Creates a method handle representation of the given method.
@param methodDescription The method ro represent.
@return A method handle representing the given method. | [
"Creates",
"a",
"method",
"handle",
"representation",
"of",
"the",
"given",
"method",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L545-L551 |
22,724 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | MethodHandle.ofGetter | public static MethodHandle ofGetter(FieldDescription.InDefinedShape fieldDescription) {
return new MethodHandle(HandleType.ofGetter(fieldDescription),
fieldDescription.getDeclaringType().asErasure(),
fieldDescription.getInternalName(),
fieldDescription.getType().asErasure(),
Collections.<TypeDescription>emptyList());
} | java | public static MethodHandle ofGetter(FieldDescription.InDefinedShape fieldDescription) {
return new MethodHandle(HandleType.ofGetter(fieldDescription),
fieldDescription.getDeclaringType().asErasure(),
fieldDescription.getInternalName(),
fieldDescription.getType().asErasure(),
Collections.<TypeDescription>emptyList());
} | [
"public",
"static",
"MethodHandle",
"ofGetter",
"(",
"FieldDescription",
".",
"InDefinedShape",
"fieldDescription",
")",
"{",
"return",
"new",
"MethodHandle",
"(",
"HandleType",
".",
"ofGetter",
"(",
"fieldDescription",
")",
",",
"fieldDescription",
".",
"getDeclaringType",
"(",
")",
".",
"asErasure",
"(",
")",
",",
"fieldDescription",
".",
"getInternalName",
"(",
")",
",",
"fieldDescription",
".",
"getType",
"(",
")",
".",
"asErasure",
"(",
")",
",",
"Collections",
".",
"<",
"TypeDescription",
">",
"emptyList",
"(",
")",
")",
";",
"}"
] | Returns a method handle for a setter of the given field.
@param fieldDescription The field to represent.
@return A method handle for a setter of the given field. | [
"Returns",
"a",
"method",
"handle",
"for",
"a",
"setter",
"of",
"the",
"given",
"field",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L598-L604 |
22,725 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | MethodHandle.ofSetter | public static MethodHandle ofSetter(FieldDescription.InDefinedShape fieldDescription) {
return new MethodHandle(HandleType.ofSetter(fieldDescription),
fieldDescription.getDeclaringType().asErasure(),
fieldDescription.getInternalName(),
TypeDescription.VOID,
Collections.singletonList(fieldDescription.getType().asErasure()));
} | java | public static MethodHandle ofSetter(FieldDescription.InDefinedShape fieldDescription) {
return new MethodHandle(HandleType.ofSetter(fieldDescription),
fieldDescription.getDeclaringType().asErasure(),
fieldDescription.getInternalName(),
TypeDescription.VOID,
Collections.singletonList(fieldDescription.getType().asErasure()));
} | [
"public",
"static",
"MethodHandle",
"ofSetter",
"(",
"FieldDescription",
".",
"InDefinedShape",
"fieldDescription",
")",
"{",
"return",
"new",
"MethodHandle",
"(",
"HandleType",
".",
"ofSetter",
"(",
"fieldDescription",
")",
",",
"fieldDescription",
".",
"getDeclaringType",
"(",
")",
".",
"asErasure",
"(",
")",
",",
"fieldDescription",
".",
"getInternalName",
"(",
")",
",",
"TypeDescription",
".",
"VOID",
",",
"Collections",
".",
"singletonList",
"(",
"fieldDescription",
".",
"getType",
"(",
")",
".",
"asErasure",
"(",
")",
")",
")",
";",
"}"
] | Returns a method handle for a getter of the given field.
@param fieldDescription The field to represent.
@return A method handle for a getter of the given field. | [
"Returns",
"a",
"method",
"handle",
"for",
"a",
"getter",
"of",
"the",
"given",
"field",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L622-L628 |
22,726 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | MethodHandle.getDescriptor | public String getDescriptor() {
StringBuilder stringBuilder = new StringBuilder().append('(');
for (TypeDescription parameterType : parameterTypes) {
stringBuilder.append(parameterType.getDescriptor());
}
return stringBuilder.append(')').append(returnType.getDescriptor()).toString();
} | java | public String getDescriptor() {
StringBuilder stringBuilder = new StringBuilder().append('(');
for (TypeDescription parameterType : parameterTypes) {
stringBuilder.append(parameterType.getDescriptor());
}
return stringBuilder.append(')').append(returnType.getDescriptor()).toString();
} | [
"public",
"String",
"getDescriptor",
"(",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"TypeDescription",
"parameterType",
":",
"parameterTypes",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"parameterType",
".",
"getDescriptor",
"(",
")",
")",
";",
"}",
"return",
"stringBuilder",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"returnType",
".",
"getDescriptor",
"(",
")",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the method descriptor of this method handle representation.
@return The method descriptor of this method handle representation. | [
"Returns",
"the",
"method",
"descriptor",
"of",
"this",
"method",
"handle",
"representation",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L699-L705 |
22,727 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | Dynamic.ofVarHandle | public static JavaConstant ofVarHandle(FieldDescription.InDefinedShape fieldDescription) {
return new Dynamic(new ConstantDynamic(fieldDescription.getInternalName(),
JavaType.VAR_HANDLE.getTypeStub().getDescriptor(),
new Handle(Opcodes.H_INVOKESTATIC,
CONSTANT_BOOTSTRAPS,
fieldDescription.isStatic()
? "staticFieldVarHandle"
: "fieldVarHandle",
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;",
false),
Type.getType(fieldDescription.getDeclaringType().getDescriptor()),
Type.getType(fieldDescription.getType().asErasure().getDescriptor())), JavaType.VAR_HANDLE.getTypeStub());
} | java | public static JavaConstant ofVarHandle(FieldDescription.InDefinedShape fieldDescription) {
return new Dynamic(new ConstantDynamic(fieldDescription.getInternalName(),
JavaType.VAR_HANDLE.getTypeStub().getDescriptor(),
new Handle(Opcodes.H_INVOKESTATIC,
CONSTANT_BOOTSTRAPS,
fieldDescription.isStatic()
? "staticFieldVarHandle"
: "fieldVarHandle",
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;",
false),
Type.getType(fieldDescription.getDeclaringType().getDescriptor()),
Type.getType(fieldDescription.getType().asErasure().getDescriptor())), JavaType.VAR_HANDLE.getTypeStub());
} | [
"public",
"static",
"JavaConstant",
"ofVarHandle",
"(",
"FieldDescription",
".",
"InDefinedShape",
"fieldDescription",
")",
"{",
"return",
"new",
"Dynamic",
"(",
"new",
"ConstantDynamic",
"(",
"fieldDescription",
".",
"getInternalName",
"(",
")",
",",
"JavaType",
".",
"VAR_HANDLE",
".",
"getTypeStub",
"(",
")",
".",
"getDescriptor",
"(",
")",
",",
"new",
"Handle",
"(",
"Opcodes",
".",
"H_INVOKESTATIC",
",",
"CONSTANT_BOOTSTRAPS",
",",
"fieldDescription",
".",
"isStatic",
"(",
")",
"?",
"\"staticFieldVarHandle\"",
":",
"\"fieldVarHandle\"",
",",
"\"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;\"",
",",
"false",
")",
",",
"Type",
".",
"getType",
"(",
"fieldDescription",
".",
"getDeclaringType",
"(",
")",
".",
"getDescriptor",
"(",
")",
")",
",",
"Type",
".",
"getType",
"(",
"fieldDescription",
".",
"getType",
"(",
")",
".",
"asErasure",
"(",
")",
".",
"getDescriptor",
"(",
")",
")",
")",
",",
"JavaType",
".",
"VAR_HANDLE",
".",
"getTypeStub",
"(",
")",
")",
";",
"}"
] | Resolves a var handle constant for a field.
@param fieldDescription The field to represent a var handle for.
@return A dynamic constant that represents the created var handle constant. | [
"Resolves",
"a",
"var",
"handle",
"constant",
"for",
"a",
"field",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L1655-L1667 |
22,728 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java | Dynamic.ofArrayVarHandle | public static JavaConstant ofArrayVarHandle(TypeDescription typeDescription) {
if (!typeDescription.isArray()) {
throw new IllegalArgumentException("Not an array type: " + typeDescription);
}
return new Dynamic(new ConstantDynamic("arrayVarHandle",
JavaType.VAR_HANDLE.getTypeStub().getDescriptor(),
new Handle(Opcodes.H_INVOKESTATIC,
CONSTANT_BOOTSTRAPS,
"arrayVarHandle",
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;",
false),
Type.getType(typeDescription.getDescriptor())), JavaType.VAR_HANDLE.getTypeStub());
} | java | public static JavaConstant ofArrayVarHandle(TypeDescription typeDescription) {
if (!typeDescription.isArray()) {
throw new IllegalArgumentException("Not an array type: " + typeDescription);
}
return new Dynamic(new ConstantDynamic("arrayVarHandle",
JavaType.VAR_HANDLE.getTypeStub().getDescriptor(),
new Handle(Opcodes.H_INVOKESTATIC,
CONSTANT_BOOTSTRAPS,
"arrayVarHandle",
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;",
false),
Type.getType(typeDescription.getDescriptor())), JavaType.VAR_HANDLE.getTypeStub());
} | [
"public",
"static",
"JavaConstant",
"ofArrayVarHandle",
"(",
"TypeDescription",
"typeDescription",
")",
"{",
"if",
"(",
"!",
"typeDescription",
".",
"isArray",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not an array type: \"",
"+",
"typeDescription",
")",
";",
"}",
"return",
"new",
"Dynamic",
"(",
"new",
"ConstantDynamic",
"(",
"\"arrayVarHandle\"",
",",
"JavaType",
".",
"VAR_HANDLE",
".",
"getTypeStub",
"(",
")",
".",
"getDescriptor",
"(",
")",
",",
"new",
"Handle",
"(",
"Opcodes",
".",
"H_INVOKESTATIC",
",",
"CONSTANT_BOOTSTRAPS",
",",
"\"arrayVarHandle\"",
",",
"\"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/invoke/VarHandle;\"",
",",
"false",
")",
",",
"Type",
".",
"getType",
"(",
"typeDescription",
".",
"getDescriptor",
"(",
")",
")",
")",
",",
"JavaType",
".",
"VAR_HANDLE",
".",
"getTypeStub",
"(",
")",
")",
";",
"}"
] | Resolves a var handle constant for an array.
@param typeDescription The array type for which the var handle is resolved.
@return A dynamic constant that represents the created var handle constant. | [
"Resolves",
"a",
"var",
"handle",
"constant",
"for",
"an",
"array",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L1685-L1697 |
22,729 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/TrivialClassCreationBenchmark.java | TrivialClassCreationBenchmark.benchmarkJavassist | @Benchmark
public Class<?> benchmarkJavassist() {
ProxyFactory proxyFactory = new ProxyFactory() {
protected ClassLoader getClassLoader() {
return newClassLoader();
}
};
proxyFactory.setUseCache(false);
proxyFactory.setUseWriteReplace(false);
proxyFactory.setSuperclass(baseClass);
proxyFactory.setFilter(new MethodFilter() {
public boolean isHandled(Method method) {
return false;
}
});
return proxyFactory.createClass();
} | java | @Benchmark
public Class<?> benchmarkJavassist() {
ProxyFactory proxyFactory = new ProxyFactory() {
protected ClassLoader getClassLoader() {
return newClassLoader();
}
};
proxyFactory.setUseCache(false);
proxyFactory.setUseWriteReplace(false);
proxyFactory.setSuperclass(baseClass);
proxyFactory.setFilter(new MethodFilter() {
public boolean isHandled(Method method) {
return false;
}
});
return proxyFactory.createClass();
} | [
"@",
"Benchmark",
"public",
"Class",
"<",
"?",
">",
"benchmarkJavassist",
"(",
")",
"{",
"ProxyFactory",
"proxyFactory",
"=",
"new",
"ProxyFactory",
"(",
")",
"{",
"protected",
"ClassLoader",
"getClassLoader",
"(",
")",
"{",
"return",
"newClassLoader",
"(",
")",
";",
"}",
"}",
";",
"proxyFactory",
".",
"setUseCache",
"(",
"false",
")",
";",
"proxyFactory",
".",
"setUseWriteReplace",
"(",
"false",
")",
";",
"proxyFactory",
".",
"setSuperclass",
"(",
"baseClass",
")",
";",
"proxyFactory",
".",
"setFilter",
"(",
"new",
"MethodFilter",
"(",
")",
"{",
"public",
"boolean",
"isHandled",
"(",
"Method",
"method",
")",
"{",
"return",
"false",
";",
"}",
"}",
")",
";",
"return",
"proxyFactory",
".",
"createClass",
"(",
")",
";",
"}"
] | Performs a benchmark for a trivial class creation using javassist proxies.
@return The created instance, in order to avoid JIT removal. | [
"Performs",
"a",
"benchmark",
"for",
"a",
"trivial",
"class",
"creation",
"using",
"javassist",
"proxies",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/TrivialClassCreationBenchmark.java#L122-L138 |
22,730 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberRemoval.java | MemberRemoval.stripFields | public MemberRemoval stripFields(ElementMatcher<? super FieldDescription.InDefinedShape> matcher) {
return new MemberRemoval(fieldMatcher.or(matcher), methodMatcher);
} | java | public MemberRemoval stripFields(ElementMatcher<? super FieldDescription.InDefinedShape> matcher) {
return new MemberRemoval(fieldMatcher.or(matcher), methodMatcher);
} | [
"public",
"MemberRemoval",
"stripFields",
"(",
"ElementMatcher",
"<",
"?",
"super",
"FieldDescription",
".",
"InDefinedShape",
">",
"matcher",
")",
"{",
"return",
"new",
"MemberRemoval",
"(",
"fieldMatcher",
".",
"or",
"(",
"matcher",
")",
",",
"methodMatcher",
")",
";",
"}"
] | Specifies that any field that matches the specified matcher should be removed.
@param matcher The matcher that decides upon field removal.
@return A new member removal instance that removes all previously specified members and any fields that match the specified matcher. | [
"Specifies",
"that",
"any",
"field",
"that",
"matches",
"the",
"specified",
"matcher",
"should",
"be",
"removed",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberRemoval.java#L92-L94 |
22,731 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberRemoval.java | MemberRemoval.stripInvokables | public MemberRemoval stripInvokables(ElementMatcher<? super MethodDescription> matcher) {
return new MemberRemoval(fieldMatcher, methodMatcher.or(matcher));
} | java | public MemberRemoval stripInvokables(ElementMatcher<? super MethodDescription> matcher) {
return new MemberRemoval(fieldMatcher, methodMatcher.or(matcher));
} | [
"public",
"MemberRemoval",
"stripInvokables",
"(",
"ElementMatcher",
"<",
"?",
"super",
"MethodDescription",
">",
"matcher",
")",
"{",
"return",
"new",
"MemberRemoval",
"(",
"fieldMatcher",
",",
"methodMatcher",
".",
"or",
"(",
"matcher",
")",
")",
";",
"}"
] | Specifies that any method or constructor that matches the specified matcher should be removed.
@param matcher The matcher that decides upon method and constructor removal.
@return A new member removal instance that removes all previously specified members and any method or constructor that matches the specified matcher. | [
"Specifies",
"that",
"any",
"method",
"or",
"constructor",
"that",
"matches",
"the",
"specified",
"matcher",
"should",
"be",
"removed",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberRemoval.java#L122-L124 |
22,732 | raphw/byte-buddy | byte-buddy-agent/src/main/java/net/bytebuddy/agent/Attacher.java | Attacher.main | @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Exception should not be rethrown but trigger a fallback")
public static void main(String[] args) {
try {
String argument;
if (args.length < 4 || args[3].length() == 0) {
argument = null;
} else {
StringBuilder stringBuilder = new StringBuilder(args[3].substring(1));
for (int index = 4; index < args.length; index++) {
stringBuilder.append(' ').append(args[index]);
}
argument = stringBuilder.toString();
}
install(Class.forName(args[0]), args[1], args[2], argument);
} catch (Exception ignored) {
System.exit(1);
}
} | java | @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Exception should not be rethrown but trigger a fallback")
public static void main(String[] args) {
try {
String argument;
if (args.length < 4 || args[3].length() == 0) {
argument = null;
} else {
StringBuilder stringBuilder = new StringBuilder(args[3].substring(1));
for (int index = 4; index < args.length; index++) {
stringBuilder.append(' ').append(args[index]);
}
argument = stringBuilder.toString();
}
install(Class.forName(args[0]), args[1], args[2], argument);
} catch (Exception ignored) {
System.exit(1);
}
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"REC_CATCH_EXCEPTION\"",
",",
"justification",
"=",
"\"Exception should not be rethrown but trigger a fallback\"",
")",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"String",
"argument",
";",
"if",
"(",
"args",
".",
"length",
"<",
"4",
"||",
"args",
"[",
"3",
"]",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"argument",
"=",
"null",
";",
"}",
"else",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
"args",
"[",
"3",
"]",
".",
"substring",
"(",
"1",
")",
")",
";",
"for",
"(",
"int",
"index",
"=",
"4",
";",
"index",
"<",
"args",
".",
"length",
";",
"index",
"++",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"args",
"[",
"index",
"]",
")",
";",
"}",
"argument",
"=",
"stringBuilder",
".",
"toString",
"(",
")",
";",
"}",
"install",
"(",
"Class",
".",
"forName",
"(",
"args",
"[",
"0",
"]",
")",
",",
"args",
"[",
"1",
"]",
",",
"args",
"[",
"2",
"]",
",",
"argument",
")",
";",
"}",
"catch",
"(",
"Exception",
"ignored",
")",
"{",
"System",
".",
"exit",
"(",
"1",
")",
";",
"}",
"}"
] | Runs the attacher as a Java application.
@param args A list containing the fully qualified name of the virtual machine type,
the process id, the fully qualified name of the Java agent jar followed by
an empty string if the argument to the agent is {@code null} or any number
of strings where the first argument is proceeded by any single character
which is stripped off. | [
"Runs",
"the",
"attacher",
"as",
"a",
"Java",
"application",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-agent/src/main/java/net/bytebuddy/agent/Attacher.java#L63-L80 |
22,733 | raphw/byte-buddy | byte-buddy-agent/src/main/java/net/bytebuddy/agent/Attacher.java | Attacher.install | protected static void install(Class<?> virtualMachineType,
String processId,
String agent,
String argument) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Object virtualMachineInstance = virtualMachineType
.getMethod(ATTACH_METHOD_NAME, String.class)
.invoke(STATIC_MEMBER, processId);
try {
virtualMachineType
.getMethod(LOAD_AGENT_METHOD_NAME, String.class, String.class)
.invoke(virtualMachineInstance, agent, argument);
} finally {
virtualMachineType
.getMethod(DETACH_METHOD_NAME)
.invoke(virtualMachineInstance);
}
} | java | protected static void install(Class<?> virtualMachineType,
String processId,
String agent,
String argument) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Object virtualMachineInstance = virtualMachineType
.getMethod(ATTACH_METHOD_NAME, String.class)
.invoke(STATIC_MEMBER, processId);
try {
virtualMachineType
.getMethod(LOAD_AGENT_METHOD_NAME, String.class, String.class)
.invoke(virtualMachineInstance, agent, argument);
} finally {
virtualMachineType
.getMethod(DETACH_METHOD_NAME)
.invoke(virtualMachineInstance);
}
} | [
"protected",
"static",
"void",
"install",
"(",
"Class",
"<",
"?",
">",
"virtualMachineType",
",",
"String",
"processId",
",",
"String",
"agent",
",",
"String",
"argument",
")",
"throws",
"NoSuchMethodException",
",",
"InvocationTargetException",
",",
"IllegalAccessException",
"{",
"Object",
"virtualMachineInstance",
"=",
"virtualMachineType",
".",
"getMethod",
"(",
"ATTACH_METHOD_NAME",
",",
"String",
".",
"class",
")",
".",
"invoke",
"(",
"STATIC_MEMBER",
",",
"processId",
")",
";",
"try",
"{",
"virtualMachineType",
".",
"getMethod",
"(",
"LOAD_AGENT_METHOD_NAME",
",",
"String",
".",
"class",
",",
"String",
".",
"class",
")",
".",
"invoke",
"(",
"virtualMachineInstance",
",",
"agent",
",",
"argument",
")",
";",
"}",
"finally",
"{",
"virtualMachineType",
".",
"getMethod",
"(",
"DETACH_METHOD_NAME",
")",
".",
"invoke",
"(",
"virtualMachineInstance",
")",
";",
"}",
"}"
] | Installs a Java agent on a target VM.
@param virtualMachineType The virtual machine type to use for the external attachment.
@param processId The id of the process being target of the external attachment.
@param agent The Java agent to attach.
@param argument The argument to provide or {@code null} if no argument is provided.
@throws NoSuchMethodException If the virtual machine type does not define an expected method.
@throws InvocationTargetException If the virtual machine type raises an error.
@throws IllegalAccessException If a method of the virtual machine type cannot be accessed. | [
"Installs",
"a",
"Java",
"agent",
"on",
"a",
"target",
"VM",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-agent/src/main/java/net/bytebuddy/agent/Attacher.java#L93-L109 |
22,734 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/StreamDrainer.java | StreamDrainer.drain | public byte[] drain(InputStream inputStream) throws IOException {
List<byte[]> previousBytes = new ArrayList<byte[]>();
byte[] currentArray = new byte[bufferSize];
int currentIndex = 0;
int currentRead;
do {
currentRead = inputStream.read(currentArray, currentIndex, bufferSize - currentIndex);
currentIndex += currentRead > 0 ? currentRead : 0;
if (currentIndex == bufferSize) {
previousBytes.add(currentArray);
currentArray = new byte[bufferSize];
currentIndex = 0;
}
} while (currentRead != END_OF_STREAM);
byte[] result = new byte[previousBytes.size() * bufferSize + currentIndex];
int arrayIndex = 0;
for (byte[] previousByte : previousBytes) {
System.arraycopy(previousByte, FROM_BEGINNING, result, arrayIndex++ * bufferSize, bufferSize);
}
System.arraycopy(currentArray, FROM_BEGINNING, result, arrayIndex * bufferSize, currentIndex);
return result;
} | java | public byte[] drain(InputStream inputStream) throws IOException {
List<byte[]> previousBytes = new ArrayList<byte[]>();
byte[] currentArray = new byte[bufferSize];
int currentIndex = 0;
int currentRead;
do {
currentRead = inputStream.read(currentArray, currentIndex, bufferSize - currentIndex);
currentIndex += currentRead > 0 ? currentRead : 0;
if (currentIndex == bufferSize) {
previousBytes.add(currentArray);
currentArray = new byte[bufferSize];
currentIndex = 0;
}
} while (currentRead != END_OF_STREAM);
byte[] result = new byte[previousBytes.size() * bufferSize + currentIndex];
int arrayIndex = 0;
for (byte[] previousByte : previousBytes) {
System.arraycopy(previousByte, FROM_BEGINNING, result, arrayIndex++ * bufferSize, bufferSize);
}
System.arraycopy(currentArray, FROM_BEGINNING, result, arrayIndex * bufferSize, currentIndex);
return result;
} | [
"public",
"byte",
"[",
"]",
"drain",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"List",
"<",
"byte",
"[",
"]",
">",
"previousBytes",
"=",
"new",
"ArrayList",
"<",
"byte",
"[",
"]",
">",
"(",
")",
";",
"byte",
"[",
"]",
"currentArray",
"=",
"new",
"byte",
"[",
"bufferSize",
"]",
";",
"int",
"currentIndex",
"=",
"0",
";",
"int",
"currentRead",
";",
"do",
"{",
"currentRead",
"=",
"inputStream",
".",
"read",
"(",
"currentArray",
",",
"currentIndex",
",",
"bufferSize",
"-",
"currentIndex",
")",
";",
"currentIndex",
"+=",
"currentRead",
">",
"0",
"?",
"currentRead",
":",
"0",
";",
"if",
"(",
"currentIndex",
"==",
"bufferSize",
")",
"{",
"previousBytes",
".",
"add",
"(",
"currentArray",
")",
";",
"currentArray",
"=",
"new",
"byte",
"[",
"bufferSize",
"]",
";",
"currentIndex",
"=",
"0",
";",
"}",
"}",
"while",
"(",
"currentRead",
"!=",
"END_OF_STREAM",
")",
";",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"previousBytes",
".",
"size",
"(",
")",
"*",
"bufferSize",
"+",
"currentIndex",
"]",
";",
"int",
"arrayIndex",
"=",
"0",
";",
"for",
"(",
"byte",
"[",
"]",
"previousByte",
":",
"previousBytes",
")",
"{",
"System",
".",
"arraycopy",
"(",
"previousByte",
",",
"FROM_BEGINNING",
",",
"result",
",",
"arrayIndex",
"++",
"*",
"bufferSize",
",",
"bufferSize",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"currentArray",
",",
"FROM_BEGINNING",
",",
"result",
",",
"arrayIndex",
"*",
"bufferSize",
",",
"currentIndex",
")",
";",
"return",
"result",
";",
"}"
] | Drains an input stream into a byte array. The given input stream is not closed.
@param inputStream The input stream to drain.
@return A byte array containing the content of the input stream.
@throws IOException If the stream reading causes an error. | [
"Drains",
"an",
"input",
"stream",
"into",
"a",
"byte",
"array",
".",
"The",
"given",
"input",
"stream",
"is",
"not",
"closed",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/StreamDrainer.java#L79-L100 |
22,735 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/Nexus.java | Nexus.nonAnonymous | private static String nonAnonymous(String typeName) {
int anonymousLoaderIndex = typeName.indexOf('/');
return anonymousLoaderIndex == -1
? typeName
: typeName.substring(0, anonymousLoaderIndex);
} | java | private static String nonAnonymous(String typeName) {
int anonymousLoaderIndex = typeName.indexOf('/');
return anonymousLoaderIndex == -1
? typeName
: typeName.substring(0, anonymousLoaderIndex);
} | [
"private",
"static",
"String",
"nonAnonymous",
"(",
"String",
"typeName",
")",
"{",
"int",
"anonymousLoaderIndex",
"=",
"typeName",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"return",
"anonymousLoaderIndex",
"==",
"-",
"1",
"?",
"typeName",
":",
"typeName",
".",
"substring",
"(",
"0",
",",
"anonymousLoaderIndex",
")",
";",
"}"
] | Normalizes a type name if it is loaded by an anonymous class loader.
@param typeName The name as returned by {@link Class#getName()}.
@return The non-anonymous name of the given class. | [
"Normalizes",
"a",
"type",
"name",
"if",
"it",
"is",
"loaded",
"by",
"an",
"anonymous",
"class",
"loader",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/Nexus.java#L111-L116 |
22,736 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java | ExceptionTableSensitiveMethodVisitor.onVisitFieldInsn | protected void onVisitFieldInsn(int opcode, String owner, String name, String descriptor) {
super.visitFieldInsn(opcode, owner, name, descriptor);
} | java | protected void onVisitFieldInsn(int opcode, String owner, String name, String descriptor) {
super.visitFieldInsn(opcode, owner, name, descriptor);
} | [
"protected",
"void",
"onVisitFieldInsn",
"(",
"int",
"opcode",
",",
"String",
"owner",
",",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"super",
".",
"visitFieldInsn",
"(",
"opcode",
",",
"owner",
",",
"name",
",",
"descriptor",
")",
";",
"}"
] | Visits a field instruction.
@param opcode The visited opcode.
@param owner The field's owner.
@param name The field's name.
@param descriptor The field's descriptor. | [
"Visits",
"a",
"field",
"instruction",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java#L138-L140 |
22,737 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java | ExceptionTableSensitiveMethodVisitor.onVisitTableSwitchInsn | protected void onVisitTableSwitchInsn(int minimum, int maximum, Label defaultTarget, Label... label) {
super.visitTableSwitchInsn(minimum, maximum, defaultTarget, label);
} | java | protected void onVisitTableSwitchInsn(int minimum, int maximum, Label defaultTarget, Label... label) {
super.visitTableSwitchInsn(minimum, maximum, defaultTarget, label);
} | [
"protected",
"void",
"onVisitTableSwitchInsn",
"(",
"int",
"minimum",
",",
"int",
"maximum",
",",
"Label",
"defaultTarget",
",",
"Label",
"...",
"label",
")",
"{",
"super",
".",
"visitTableSwitchInsn",
"(",
"minimum",
",",
"maximum",
",",
"defaultTarget",
",",
"label",
")",
";",
"}"
] | Visits a table switch instruction.
@param minimum The minimum index.
@param maximum The maximum index.
@param defaultTarget A label indicating the default value.
@param label Labels indicating the jump targets. | [
"Visits",
"a",
"table",
"switch",
"instruction",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java#L262-L264 |
22,738 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java | ExceptionTableSensitiveMethodVisitor.onVisitLookupSwitchInsn | protected void onVisitLookupSwitchInsn(Label defaultTarget, int[] key, Label[] label) {
super.visitLookupSwitchInsn(defaultTarget, key, label);
} | java | protected void onVisitLookupSwitchInsn(Label defaultTarget, int[] key, Label[] label) {
super.visitLookupSwitchInsn(defaultTarget, key, label);
} | [
"protected",
"void",
"onVisitLookupSwitchInsn",
"(",
"Label",
"defaultTarget",
",",
"int",
"[",
"]",
"key",
",",
"Label",
"[",
"]",
"label",
")",
"{",
"super",
".",
"visitLookupSwitchInsn",
"(",
"defaultTarget",
",",
"key",
",",
"label",
")",
";",
"}"
] | Visits a lookup switch instruction.
@param defaultTarget The default option.
@param key The key values.
@param label The targets for each key. | [
"Visits",
"a",
"lookup",
"switch",
"instruction",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/ExceptionTableSensitiveMethodVisitor.java#L279-L281 |
22,739 | raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java | AbstractUserConfiguration.getGroupId | protected String getGroupId(String groupId) {
return this.groupId == null || this.groupId.length() == 0
? groupId
: this.groupId;
} | java | protected String getGroupId(String groupId) {
return this.groupId == null || this.groupId.length() == 0
? groupId
: this.groupId;
} | [
"protected",
"String",
"getGroupId",
"(",
"String",
"groupId",
")",
"{",
"return",
"this",
".",
"groupId",
"==",
"null",
"||",
"this",
".",
"groupId",
".",
"length",
"(",
")",
"==",
"0",
"?",
"groupId",
":",
"this",
".",
"groupId",
";",
"}"
] | Returns the group id to use.
@param groupId The current project's group id.
@return The group id to use. | [
"Returns",
"the",
"group",
"id",
"to",
"use",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java#L52-L56 |
22,740 | raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java | AbstractUserConfiguration.getArtifactId | protected String getArtifactId(String artifactId) {
return this.artifactId == null || this.artifactId.length() == 0
? artifactId
: this.artifactId;
} | java | protected String getArtifactId(String artifactId) {
return this.artifactId == null || this.artifactId.length() == 0
? artifactId
: this.artifactId;
} | [
"protected",
"String",
"getArtifactId",
"(",
"String",
"artifactId",
")",
"{",
"return",
"this",
".",
"artifactId",
"==",
"null",
"||",
"this",
".",
"artifactId",
".",
"length",
"(",
")",
"==",
"0",
"?",
"artifactId",
":",
"this",
".",
"artifactId",
";",
"}"
] | Returns the artifact id to use.
@param artifactId The current project's artifact id.
@return The artifact id to use. | [
"Returns",
"the",
"artifact",
"id",
"to",
"use",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java#L64-L68 |
22,741 | raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java | AbstractUserConfiguration.asCoordinate | public MavenCoordinate asCoordinate(String groupId, String artifactId, String version, String packaging) {
return new MavenCoordinate(getGroupId(groupId), getArtifactId(artifactId), getVersion(version), getPackaging(packaging));
} | java | public MavenCoordinate asCoordinate(String groupId, String artifactId, String version, String packaging) {
return new MavenCoordinate(getGroupId(groupId), getArtifactId(artifactId), getVersion(version), getPackaging(packaging));
} | [
"public",
"MavenCoordinate",
"asCoordinate",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
",",
"String",
"packaging",
")",
"{",
"return",
"new",
"MavenCoordinate",
"(",
"getGroupId",
"(",
"groupId",
")",
",",
"getArtifactId",
"(",
"artifactId",
")",
",",
"getVersion",
"(",
"version",
")",
",",
"getPackaging",
"(",
"packaging",
")",
")",
";",
"}"
] | Resolves this transformation to a Maven coordinate.
@param groupId The current project's build id.
@param artifactId The current project's artifact id.
@param version The current project's version.
@param packaging The current project's packaging
@return The resolved Maven coordinate. | [
"Resolves",
"this",
"transformation",
"to",
"a",
"Maven",
"coordinate",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/AbstractUserConfiguration.java#L104-L106 |
22,742 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/inline/InliningImplementationMatcher.java | InliningImplementationMatcher.of | protected static LatentMatcher<MethodDescription> of(LatentMatcher<? super MethodDescription> ignoredMethods, TypeDescription originalType) {
ElementMatcher.Junction<MethodDescription> predefinedMethodSignatures = none();
for (MethodDescription methodDescription : originalType.getDeclaredMethods()) {
ElementMatcher.Junction<MethodDescription> signature = methodDescription.isConstructor()
? isConstructor()
: ElementMatchers.<MethodDescription>named(methodDescription.getName());
signature = signature.and(returns(methodDescription.getReturnType().asErasure()));
signature = signature.and(takesArguments(methodDescription.getParameters().asTypeList().asErasures()));
predefinedMethodSignatures = predefinedMethodSignatures.or(signature);
}
return new InliningImplementationMatcher(ignoredMethods, predefinedMethodSignatures);
} | java | protected static LatentMatcher<MethodDescription> of(LatentMatcher<? super MethodDescription> ignoredMethods, TypeDescription originalType) {
ElementMatcher.Junction<MethodDescription> predefinedMethodSignatures = none();
for (MethodDescription methodDescription : originalType.getDeclaredMethods()) {
ElementMatcher.Junction<MethodDescription> signature = methodDescription.isConstructor()
? isConstructor()
: ElementMatchers.<MethodDescription>named(methodDescription.getName());
signature = signature.and(returns(methodDescription.getReturnType().asErasure()));
signature = signature.and(takesArguments(methodDescription.getParameters().asTypeList().asErasures()));
predefinedMethodSignatures = predefinedMethodSignatures.or(signature);
}
return new InliningImplementationMatcher(ignoredMethods, predefinedMethodSignatures);
} | [
"protected",
"static",
"LatentMatcher",
"<",
"MethodDescription",
">",
"of",
"(",
"LatentMatcher",
"<",
"?",
"super",
"MethodDescription",
">",
"ignoredMethods",
",",
"TypeDescription",
"originalType",
")",
"{",
"ElementMatcher",
".",
"Junction",
"<",
"MethodDescription",
">",
"predefinedMethodSignatures",
"=",
"none",
"(",
")",
";",
"for",
"(",
"MethodDescription",
"methodDescription",
":",
"originalType",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"ElementMatcher",
".",
"Junction",
"<",
"MethodDescription",
">",
"signature",
"=",
"methodDescription",
".",
"isConstructor",
"(",
")",
"?",
"isConstructor",
"(",
")",
":",
"ElementMatchers",
".",
"<",
"MethodDescription",
">",
"named",
"(",
"methodDescription",
".",
"getName",
"(",
")",
")",
";",
"signature",
"=",
"signature",
".",
"and",
"(",
"returns",
"(",
"methodDescription",
".",
"getReturnType",
"(",
")",
".",
"asErasure",
"(",
")",
")",
")",
";",
"signature",
"=",
"signature",
".",
"and",
"(",
"takesArguments",
"(",
"methodDescription",
".",
"getParameters",
"(",
")",
".",
"asTypeList",
"(",
")",
".",
"asErasures",
"(",
")",
")",
")",
";",
"predefinedMethodSignatures",
"=",
"predefinedMethodSignatures",
".",
"or",
"(",
"signature",
")",
";",
"}",
"return",
"new",
"InliningImplementationMatcher",
"(",
"ignoredMethods",
",",
"predefinedMethodSignatures",
")",
";",
"}"
] | Creates a matcher where only overridable or declared methods are matched unless those are ignored. Methods that
are declared by the target type are only matched if they are not ignored. Declared methods that are not found on the
target type are always matched.
@param ignoredMethods A method matcher that matches any ignored method.
@param originalType The original type of the instrumentation before adding any user methods.
@return A latent method matcher that identifies any method to instrument for a rebasement or redefinition. | [
"Creates",
"a",
"matcher",
"where",
"only",
"overridable",
"or",
"declared",
"methods",
"are",
"matched",
"unless",
"those",
"are",
"ignored",
".",
"Methods",
"that",
"are",
"declared",
"by",
"the",
"target",
"type",
"are",
"only",
"matched",
"if",
"they",
"are",
"not",
"ignored",
".",
"Declared",
"methods",
"that",
"are",
"not",
"found",
"on",
"the",
"target",
"type",
"are",
"always",
"matched",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/inline/InliningImplementationMatcher.java#L64-L75 |
22,743 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java | ClassReloadingStrategy.reset | public ClassReloadingStrategy reset(Class<?>... type) throws IOException {
return type.length == 0
? this
: reset(ClassFileLocator.ForClassLoader.of(type[0].getClassLoader()), type);
} | java | public ClassReloadingStrategy reset(Class<?>... type) throws IOException {
return type.length == 0
? this
: reset(ClassFileLocator.ForClassLoader.of(type[0].getClassLoader()), type);
} | [
"public",
"ClassReloadingStrategy",
"reset",
"(",
"Class",
"<",
"?",
">",
"...",
"type",
")",
"throws",
"IOException",
"{",
"return",
"type",
".",
"length",
"==",
"0",
"?",
"this",
":",
"reset",
"(",
"ClassFileLocator",
".",
"ForClassLoader",
".",
"of",
"(",
"type",
"[",
"0",
"]",
".",
"getClassLoader",
"(",
")",
")",
",",
"type",
")",
";",
"}"
] | Resets all classes to their original definition while using the first type's class loader as a class file locator.
@param type The types to reset.
@return This class reloading strategy.
@throws IOException If a class file locator causes an IO exception. | [
"Resets",
"all",
"classes",
"to",
"their",
"original",
"definition",
"while",
"using",
"the",
"first",
"type",
"s",
"class",
"loader",
"as",
"a",
"class",
"file",
"locator",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L246-L250 |
22,744 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java | ClassReloadingStrategy.reset | public ClassReloadingStrategy reset(ClassFileLocator classFileLocator, Class<?>... type) throws IOException {
if (type.length > 0) {
try {
strategy.reset(instrumentation, classFileLocator, Arrays.asList(type));
} catch (ClassNotFoundException exception) {
throw new IllegalArgumentException("Cannot locate types " + Arrays.toString(type), exception);
} catch (UnmodifiableClassException exception) {
throw new IllegalStateException("Cannot reset types " + Arrays.toString(type), exception);
}
}
return this;
} | java | public ClassReloadingStrategy reset(ClassFileLocator classFileLocator, Class<?>... type) throws IOException {
if (type.length > 0) {
try {
strategy.reset(instrumentation, classFileLocator, Arrays.asList(type));
} catch (ClassNotFoundException exception) {
throw new IllegalArgumentException("Cannot locate types " + Arrays.toString(type), exception);
} catch (UnmodifiableClassException exception) {
throw new IllegalStateException("Cannot reset types " + Arrays.toString(type), exception);
}
}
return this;
} | [
"public",
"ClassReloadingStrategy",
"reset",
"(",
"ClassFileLocator",
"classFileLocator",
",",
"Class",
"<",
"?",
">",
"...",
"type",
")",
"throws",
"IOException",
"{",
"if",
"(",
"type",
".",
"length",
">",
"0",
")",
"{",
"try",
"{",
"strategy",
".",
"reset",
"(",
"instrumentation",
",",
"classFileLocator",
",",
"Arrays",
".",
"asList",
"(",
"type",
")",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"exception",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot locate types \"",
"+",
"Arrays",
".",
"toString",
"(",
"type",
")",
",",
"exception",
")",
";",
"}",
"catch",
"(",
"UnmodifiableClassException",
"exception",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot reset types \"",
"+",
"Arrays",
".",
"toString",
"(",
"type",
")",
",",
"exception",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Resets all classes to their original definition.
@param classFileLocator The class file locator to use.
@param type The types to reset.
@return This class reloading strategy.
@throws IOException If a class file locator causes an IO exception. | [
"Resets",
"all",
"classes",
"to",
"their",
"original",
"definition",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L260-L271 |
22,745 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java | ClassReloadingStrategy.enableBootstrapInjection | public ClassReloadingStrategy enableBootstrapInjection(File folder) {
return new ClassReloadingStrategy(instrumentation, strategy, new BootstrapInjection.Enabled(folder), preregisteredTypes);
} | java | public ClassReloadingStrategy enableBootstrapInjection(File folder) {
return new ClassReloadingStrategy(instrumentation, strategy, new BootstrapInjection.Enabled(folder), preregisteredTypes);
} | [
"public",
"ClassReloadingStrategy",
"enableBootstrapInjection",
"(",
"File",
"folder",
")",
"{",
"return",
"new",
"ClassReloadingStrategy",
"(",
"instrumentation",
",",
"strategy",
",",
"new",
"BootstrapInjection",
".",
"Enabled",
"(",
"folder",
")",
",",
"preregisteredTypes",
")",
";",
"}"
] | Enables bootstrap injection for this class reloading strategy.
@param folder The folder to save jar files in that are appended to the bootstrap class path.
@return A class reloading strategy with bootstrap injection enabled. | [
"Enables",
"bootstrap",
"injection",
"for",
"this",
"class",
"reloading",
"strategy",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L279-L281 |
22,746 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java | ClassReloadingStrategy.preregistered | public ClassReloadingStrategy preregistered(Class<?>... type) {
Map<String, Class<?>> preregisteredTypes = new HashMap<String, Class<?>>(this.preregisteredTypes);
for (Class<?> aType : type) {
preregisteredTypes.put(TypeDescription.ForLoadedType.getName(aType), aType);
}
return new ClassReloadingStrategy(instrumentation, strategy, bootstrapInjection, preregisteredTypes);
} | java | public ClassReloadingStrategy preregistered(Class<?>... type) {
Map<String, Class<?>> preregisteredTypes = new HashMap<String, Class<?>>(this.preregisteredTypes);
for (Class<?> aType : type) {
preregisteredTypes.put(TypeDescription.ForLoadedType.getName(aType), aType);
}
return new ClassReloadingStrategy(instrumentation, strategy, bootstrapInjection, preregisteredTypes);
} | [
"public",
"ClassReloadingStrategy",
"preregistered",
"(",
"Class",
"<",
"?",
">",
"...",
"type",
")",
"{",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"preregisteredTypes",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"(",
"this",
".",
"preregisteredTypes",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"aType",
":",
"type",
")",
"{",
"preregisteredTypes",
".",
"put",
"(",
"TypeDescription",
".",
"ForLoadedType",
".",
"getName",
"(",
"aType",
")",
",",
"aType",
")",
";",
"}",
"return",
"new",
"ClassReloadingStrategy",
"(",
"instrumentation",
",",
"strategy",
",",
"bootstrapInjection",
",",
"preregisteredTypes",
")",
";",
"}"
] | Registers a type to be explicitly available without explicit lookup.
@param type The loaded types that are explicitly available.
@return This class reloading strategy with the given types being explicitly available. | [
"Registers",
"a",
"type",
"to",
"be",
"explicitly",
"available",
"without",
"explicit",
"lookup",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L289-L295 |
22,747 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/subclass/SubclassImplementationTarget.java | SubclassImplementationTarget.invokeConstructor | private Implementation.SpecialMethodInvocation invokeConstructor(MethodDescription.SignatureToken token) {
TypeDescription.Generic superClass = instrumentedType.getSuperClass();
MethodList<?> candidates = superClass == null
? new MethodList.Empty<MethodDescription.InGenericShape>()
: superClass.getDeclaredMethods().filter(hasSignature(token).and(isVisibleTo(instrumentedType)));
return candidates.size() == 1
? Implementation.SpecialMethodInvocation.Simple.of(candidates.getOnly(), instrumentedType.getSuperClass().asErasure())
: Implementation.SpecialMethodInvocation.Illegal.INSTANCE;
} | java | private Implementation.SpecialMethodInvocation invokeConstructor(MethodDescription.SignatureToken token) {
TypeDescription.Generic superClass = instrumentedType.getSuperClass();
MethodList<?> candidates = superClass == null
? new MethodList.Empty<MethodDescription.InGenericShape>()
: superClass.getDeclaredMethods().filter(hasSignature(token).and(isVisibleTo(instrumentedType)));
return candidates.size() == 1
? Implementation.SpecialMethodInvocation.Simple.of(candidates.getOnly(), instrumentedType.getSuperClass().asErasure())
: Implementation.SpecialMethodInvocation.Illegal.INSTANCE;
} | [
"private",
"Implementation",
".",
"SpecialMethodInvocation",
"invokeConstructor",
"(",
"MethodDescription",
".",
"SignatureToken",
"token",
")",
"{",
"TypeDescription",
".",
"Generic",
"superClass",
"=",
"instrumentedType",
".",
"getSuperClass",
"(",
")",
";",
"MethodList",
"<",
"?",
">",
"candidates",
"=",
"superClass",
"==",
"null",
"?",
"new",
"MethodList",
".",
"Empty",
"<",
"MethodDescription",
".",
"InGenericShape",
">",
"(",
")",
":",
"superClass",
".",
"getDeclaredMethods",
"(",
")",
".",
"filter",
"(",
"hasSignature",
"(",
"token",
")",
".",
"and",
"(",
"isVisibleTo",
"(",
"instrumentedType",
")",
")",
")",
";",
"return",
"candidates",
".",
"size",
"(",
")",
"==",
"1",
"?",
"Implementation",
".",
"SpecialMethodInvocation",
".",
"Simple",
".",
"of",
"(",
"candidates",
".",
"getOnly",
"(",
")",
",",
"instrumentedType",
".",
"getSuperClass",
"(",
")",
".",
"asErasure",
"(",
")",
")",
":",
"Implementation",
".",
"SpecialMethodInvocation",
".",
"Illegal",
".",
"INSTANCE",
";",
"}"
] | Resolves a special method invocation for a constructor invocation.
@param token A token describing the constructor to be invoked.
@return A special method invocation for a constructor representing the given method token, if available. | [
"Resolves",
"a",
"special",
"method",
"invocation",
"for",
"a",
"constructor",
"invocation",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/subclass/SubclassImplementationTarget.java#L72-L80 |
22,748 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/subclass/SubclassImplementationTarget.java | SubclassImplementationTarget.invokeMethod | private Implementation.SpecialMethodInvocation invokeMethod(MethodDescription.SignatureToken token) {
MethodGraph.Node methodNode = methodGraph.getSuperClassGraph().locate(token);
return methodNode.getSort().isUnique()
? Implementation.SpecialMethodInvocation.Simple.of(methodNode.getRepresentative(), instrumentedType.getSuperClass().asErasure())
: Implementation.SpecialMethodInvocation.Illegal.INSTANCE;
} | java | private Implementation.SpecialMethodInvocation invokeMethod(MethodDescription.SignatureToken token) {
MethodGraph.Node methodNode = methodGraph.getSuperClassGraph().locate(token);
return methodNode.getSort().isUnique()
? Implementation.SpecialMethodInvocation.Simple.of(methodNode.getRepresentative(), instrumentedType.getSuperClass().asErasure())
: Implementation.SpecialMethodInvocation.Illegal.INSTANCE;
} | [
"private",
"Implementation",
".",
"SpecialMethodInvocation",
"invokeMethod",
"(",
"MethodDescription",
".",
"SignatureToken",
"token",
")",
"{",
"MethodGraph",
".",
"Node",
"methodNode",
"=",
"methodGraph",
".",
"getSuperClassGraph",
"(",
")",
".",
"locate",
"(",
"token",
")",
";",
"return",
"methodNode",
".",
"getSort",
"(",
")",
".",
"isUnique",
"(",
")",
"?",
"Implementation",
".",
"SpecialMethodInvocation",
".",
"Simple",
".",
"of",
"(",
"methodNode",
".",
"getRepresentative",
"(",
")",
",",
"instrumentedType",
".",
"getSuperClass",
"(",
")",
".",
"asErasure",
"(",
")",
")",
":",
"Implementation",
".",
"SpecialMethodInvocation",
".",
"Illegal",
".",
"INSTANCE",
";",
"}"
] | Resolves a special method invocation for a non-constructor invocation.
@param token A token describing the method to be invoked.
@return A special method invocation for a method representing the given method token, if available. | [
"Resolves",
"a",
"special",
"method",
"invocation",
"for",
"a",
"non",
"-",
"constructor",
"invocation",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/subclass/SubclassImplementationTarget.java#L88-L93 |
22,749 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java | ClassFileVersion.ofMinorMajor | public static ClassFileVersion ofMinorMajor(int versionNumber) {
ClassFileVersion classFileVersion = new ClassFileVersion(versionNumber);
if (classFileVersion.getMajorVersion() <= BASE_VERSION) {
throw new IllegalArgumentException("Class version " + versionNumber + " is not valid");
}
return classFileVersion;
} | java | public static ClassFileVersion ofMinorMajor(int versionNumber) {
ClassFileVersion classFileVersion = new ClassFileVersion(versionNumber);
if (classFileVersion.getMajorVersion() <= BASE_VERSION) {
throw new IllegalArgumentException("Class version " + versionNumber + " is not valid");
}
return classFileVersion;
} | [
"public",
"static",
"ClassFileVersion",
"ofMinorMajor",
"(",
"int",
"versionNumber",
")",
"{",
"ClassFileVersion",
"classFileVersion",
"=",
"new",
"ClassFileVersion",
"(",
"versionNumber",
")",
";",
"if",
"(",
"classFileVersion",
".",
"getMajorVersion",
"(",
")",
"<=",
"BASE_VERSION",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Class version \"",
"+",
"versionNumber",
"+",
"\" is not valid\"",
")",
";",
"}",
"return",
"classFileVersion",
";",
"}"
] | Creates a wrapper for a given minor-major release of the Java class file file.
@param versionNumber The minor-major release number.
@return A representation of the version number. | [
"Creates",
"a",
"wrapper",
"for",
"a",
"given",
"minor",
"-",
"major",
"release",
"of",
"the",
"Java",
"class",
"file",
"file",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java#L136-L142 |
22,750 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java | ClassFileVersion.ofJavaVersion | public static ClassFileVersion ofJavaVersion(int javaVersion) {
switch (javaVersion) {
case 1:
return JAVA_V1;
case 2:
return JAVA_V2;
case 3:
return JAVA_V3;
case 4:
return JAVA_V4;
case 5:
return JAVA_V5;
case 6:
return JAVA_V6;
case 7:
return JAVA_V7;
case 8:
return JAVA_V8;
case 9:
return JAVA_V9;
case 10:
return JAVA_V10;
case 11:
return JAVA_V11;
case 12:
return JAVA_V12;
case 13:
return JAVA_V13;
default:
if (OpenedClassReader.EXPERIMENTAL && javaVersion > 0) {
return new ClassFileVersion(BASE_VERSION + javaVersion);
} else {
throw new IllegalArgumentException("Unknown Java version: " + javaVersion);
}
}
} | java | public static ClassFileVersion ofJavaVersion(int javaVersion) {
switch (javaVersion) {
case 1:
return JAVA_V1;
case 2:
return JAVA_V2;
case 3:
return JAVA_V3;
case 4:
return JAVA_V4;
case 5:
return JAVA_V5;
case 6:
return JAVA_V6;
case 7:
return JAVA_V7;
case 8:
return JAVA_V8;
case 9:
return JAVA_V9;
case 10:
return JAVA_V10;
case 11:
return JAVA_V11;
case 12:
return JAVA_V12;
case 13:
return JAVA_V13;
default:
if (OpenedClassReader.EXPERIMENTAL && javaVersion > 0) {
return new ClassFileVersion(BASE_VERSION + javaVersion);
} else {
throw new IllegalArgumentException("Unknown Java version: " + javaVersion);
}
}
} | [
"public",
"static",
"ClassFileVersion",
"ofJavaVersion",
"(",
"int",
"javaVersion",
")",
"{",
"switch",
"(",
"javaVersion",
")",
"{",
"case",
"1",
":",
"return",
"JAVA_V1",
";",
"case",
"2",
":",
"return",
"JAVA_V2",
";",
"case",
"3",
":",
"return",
"JAVA_V3",
";",
"case",
"4",
":",
"return",
"JAVA_V4",
";",
"case",
"5",
":",
"return",
"JAVA_V5",
";",
"case",
"6",
":",
"return",
"JAVA_V6",
";",
"case",
"7",
":",
"return",
"JAVA_V7",
";",
"case",
"8",
":",
"return",
"JAVA_V8",
";",
"case",
"9",
":",
"return",
"JAVA_V9",
";",
"case",
"10",
":",
"return",
"JAVA_V10",
";",
"case",
"11",
":",
"return",
"JAVA_V11",
";",
"case",
"12",
":",
"return",
"JAVA_V12",
";",
"case",
"13",
":",
"return",
"JAVA_V13",
";",
"default",
":",
"if",
"(",
"OpenedClassReader",
".",
"EXPERIMENTAL",
"&&",
"javaVersion",
">",
"0",
")",
"{",
"return",
"new",
"ClassFileVersion",
"(",
"BASE_VERSION",
"+",
"javaVersion",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown Java version: \"",
"+",
"javaVersion",
")",
";",
"}",
"}",
"}"
] | Creates a class file version for a given major release of Java. Currently, all versions reaching from
Java 1 to Java 9 are supported.
@param javaVersion The Java version.
@return A wrapper for the given Java class file version. | [
"Creates",
"a",
"class",
"file",
"version",
"for",
"a",
"given",
"major",
"release",
"of",
"Java",
".",
"Currently",
"all",
"versions",
"reaching",
"from",
"Java",
"1",
"to",
"Java",
"9",
"are",
"supported",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java#L200-L235 |
22,751 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/StubInvocationBenchmark.java | StubInvocationBenchmark.baseline | @Benchmark
@OperationsPerInvocation(20)
public void baseline(Blackhole blackHole) {
blackHole.consume(baselineInstance.method(booleanValue));
blackHole.consume(baselineInstance.method(byteValue));
blackHole.consume(baselineInstance.method(shortValue));
blackHole.consume(baselineInstance.method(intValue));
blackHole.consume(baselineInstance.method(charValue));
blackHole.consume(baselineInstance.method(intValue));
blackHole.consume(baselineInstance.method(longValue));
blackHole.consume(baselineInstance.method(floatValue));
blackHole.consume(baselineInstance.method(doubleValue));
blackHole.consume(baselineInstance.method(stringValue));
blackHole.consume(baselineInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(baselineInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(baselineInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(baselineInstance.method(intValue, intValue, intValue));
blackHole.consume(baselineInstance.method(charValue, charValue, charValue));
blackHole.consume(baselineInstance.method(intValue, intValue, intValue));
blackHole.consume(baselineInstance.method(longValue, longValue, longValue));
blackHole.consume(baselineInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(baselineInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(baselineInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void baseline(Blackhole blackHole) {
blackHole.consume(baselineInstance.method(booleanValue));
blackHole.consume(baselineInstance.method(byteValue));
blackHole.consume(baselineInstance.method(shortValue));
blackHole.consume(baselineInstance.method(intValue));
blackHole.consume(baselineInstance.method(charValue));
blackHole.consume(baselineInstance.method(intValue));
blackHole.consume(baselineInstance.method(longValue));
blackHole.consume(baselineInstance.method(floatValue));
blackHole.consume(baselineInstance.method(doubleValue));
blackHole.consume(baselineInstance.method(stringValue));
blackHole.consume(baselineInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(baselineInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(baselineInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(baselineInstance.method(intValue, intValue, intValue));
blackHole.consume(baselineInstance.method(charValue, charValue, charValue));
blackHole.consume(baselineInstance.method(intValue, intValue, intValue));
blackHole.consume(baselineInstance.method(longValue, longValue, longValue));
blackHole.consume(baselineInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(baselineInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(baselineInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"baseline",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"baselineInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark for a casual class as a baseline.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"for",
"a",
"casual",
"class",
"as",
"a",
"baseline",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/StubInvocationBenchmark.java#L131-L154 |
22,752 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/StubInvocationBenchmark.java | StubInvocationBenchmark.benchmarkJavassist | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkJavassist(Blackhole blackHole) {
blackHole.consume(javassistInstance.method(booleanValue));
blackHole.consume(javassistInstance.method(byteValue));
blackHole.consume(javassistInstance.method(shortValue));
blackHole.consume(javassistInstance.method(intValue));
blackHole.consume(javassistInstance.method(charValue));
blackHole.consume(javassistInstance.method(intValue));
blackHole.consume(javassistInstance.method(longValue));
blackHole.consume(javassistInstance.method(floatValue));
blackHole.consume(javassistInstance.method(doubleValue));
blackHole.consume(javassistInstance.method(stringValue));
blackHole.consume(javassistInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(javassistInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(javassistInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(javassistInstance.method(intValue, intValue, intValue));
blackHole.consume(javassistInstance.method(charValue, charValue, charValue));
blackHole.consume(javassistInstance.method(intValue, intValue, intValue));
blackHole.consume(javassistInstance.method(longValue, longValue, longValue));
blackHole.consume(javassistInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(javassistInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(javassistInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkJavassist(Blackhole blackHole) {
blackHole.consume(javassistInstance.method(booleanValue));
blackHole.consume(javassistInstance.method(byteValue));
blackHole.consume(javassistInstance.method(shortValue));
blackHole.consume(javassistInstance.method(intValue));
blackHole.consume(javassistInstance.method(charValue));
blackHole.consume(javassistInstance.method(intValue));
blackHole.consume(javassistInstance.method(longValue));
blackHole.consume(javassistInstance.method(floatValue));
blackHole.consume(javassistInstance.method(doubleValue));
blackHole.consume(javassistInstance.method(stringValue));
blackHole.consume(javassistInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(javassistInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(javassistInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(javassistInstance.method(intValue, intValue, intValue));
blackHole.consume(javassistInstance.method(charValue, charValue, charValue));
blackHole.consume(javassistInstance.method(intValue, intValue, intValue));
blackHole.consume(javassistInstance.method(longValue, longValue, longValue));
blackHole.consume(javassistInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(javassistInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(javassistInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"benchmarkJavassist",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"javassistInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark for a trivial class creation using javassist.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"for",
"a",
"trivial",
"class",
"creation",
"using",
"javassist",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/StubInvocationBenchmark.java#L221-L244 |
22,753 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/StubInvocationBenchmark.java | StubInvocationBenchmark.benchmarkJdkProxy | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkJdkProxy(Blackhole blackHole) {
blackHole.consume(jdkProxyInstance.method(booleanValue));
blackHole.consume(jdkProxyInstance.method(byteValue));
blackHole.consume(jdkProxyInstance.method(shortValue));
blackHole.consume(jdkProxyInstance.method(intValue));
blackHole.consume(jdkProxyInstance.method(charValue));
blackHole.consume(jdkProxyInstance.method(intValue));
blackHole.consume(jdkProxyInstance.method(longValue));
blackHole.consume(jdkProxyInstance.method(floatValue));
blackHole.consume(jdkProxyInstance.method(doubleValue));
blackHole.consume(jdkProxyInstance.method(stringValue));
blackHole.consume(jdkProxyInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(jdkProxyInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(jdkProxyInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(jdkProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(jdkProxyInstance.method(charValue, charValue, charValue));
blackHole.consume(jdkProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(jdkProxyInstance.method(longValue, longValue, longValue));
blackHole.consume(jdkProxyInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(jdkProxyInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(jdkProxyInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkJdkProxy(Blackhole blackHole) {
blackHole.consume(jdkProxyInstance.method(booleanValue));
blackHole.consume(jdkProxyInstance.method(byteValue));
blackHole.consume(jdkProxyInstance.method(shortValue));
blackHole.consume(jdkProxyInstance.method(intValue));
blackHole.consume(jdkProxyInstance.method(charValue));
blackHole.consume(jdkProxyInstance.method(intValue));
blackHole.consume(jdkProxyInstance.method(longValue));
blackHole.consume(jdkProxyInstance.method(floatValue));
blackHole.consume(jdkProxyInstance.method(doubleValue));
blackHole.consume(jdkProxyInstance.method(stringValue));
blackHole.consume(jdkProxyInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(jdkProxyInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(jdkProxyInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(jdkProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(jdkProxyInstance.method(charValue, charValue, charValue));
blackHole.consume(jdkProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(jdkProxyInstance.method(longValue, longValue, longValue));
blackHole.consume(jdkProxyInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(jdkProxyInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(jdkProxyInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"benchmarkJdkProxy",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"jdkProxyInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark for a trivial class creation using the Java Class Library's utilities.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"for",
"a",
"trivial",
"class",
"creation",
"using",
"the",
"Java",
"Class",
"Library",
"s",
"utilities",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/StubInvocationBenchmark.java#L251-L274 |
22,754 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java | UsingLookup.of | public static UsingLookup of(Object lookup) {
if (!DISPATCHER.isAlive()) {
throw new IllegalStateException("The current VM does not support class definition via method handle lookups");
} else if (!JavaType.METHOD_HANDLES_LOOKUP.isInstance(lookup)) {
throw new IllegalArgumentException("Not a method handle lookup: " + lookup);
} else if ((DISPATCHER.lookupModes(lookup) & PACKAGE_LOOKUP) == 0) {
throw new IllegalArgumentException("Lookup does not imply package-access: " + lookup);
}
return new UsingLookup(DISPATCHER.dropLookupMode(lookup, Opcodes.ACC_PRIVATE));
} | java | public static UsingLookup of(Object lookup) {
if (!DISPATCHER.isAlive()) {
throw new IllegalStateException("The current VM does not support class definition via method handle lookups");
} else if (!JavaType.METHOD_HANDLES_LOOKUP.isInstance(lookup)) {
throw new IllegalArgumentException("Not a method handle lookup: " + lookup);
} else if ((DISPATCHER.lookupModes(lookup) & PACKAGE_LOOKUP) == 0) {
throw new IllegalArgumentException("Lookup does not imply package-access: " + lookup);
}
return new UsingLookup(DISPATCHER.dropLookupMode(lookup, Opcodes.ACC_PRIVATE));
} | [
"public",
"static",
"UsingLookup",
"of",
"(",
"Object",
"lookup",
")",
"{",
"if",
"(",
"!",
"DISPATCHER",
".",
"isAlive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The current VM does not support class definition via method handle lookups\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"JavaType",
".",
"METHOD_HANDLES_LOOKUP",
".",
"isInstance",
"(",
"lookup",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not a method handle lookup: \"",
"+",
"lookup",
")",
";",
"}",
"else",
"if",
"(",
"(",
"DISPATCHER",
".",
"lookupModes",
"(",
"lookup",
")",
"&",
"PACKAGE_LOOKUP",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Lookup does not imply package-access: \"",
"+",
"lookup",
")",
";",
"}",
"return",
"new",
"UsingLookup",
"(",
"DISPATCHER",
".",
"dropLookupMode",
"(",
"lookup",
",",
"Opcodes",
".",
"ACC_PRIVATE",
")",
")",
";",
"}"
] | Creates class injector that defines a class using a method handle lookup.
@param lookup The {@code java.lang.invoke.MethodHandles$Lookup} instance to use.
@return An appropriate class injector. | [
"Creates",
"class",
"injector",
"that",
"defines",
"a",
"class",
"using",
"a",
"method",
"handle",
"lookup",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java#L1370-L1379 |
22,755 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java | UsingInstrumentation.of | public static ClassInjector of(File folder, Target target, Instrumentation instrumentation) {
return new UsingInstrumentation(folder, target, instrumentation, new RandomString());
} | java | public static ClassInjector of(File folder, Target target, Instrumentation instrumentation) {
return new UsingInstrumentation(folder, target, instrumentation, new RandomString());
} | [
"public",
"static",
"ClassInjector",
"of",
"(",
"File",
"folder",
",",
"Target",
"target",
",",
"Instrumentation",
"instrumentation",
")",
"{",
"return",
"new",
"UsingInstrumentation",
"(",
"folder",
",",
"target",
",",
"instrumentation",
",",
"new",
"RandomString",
"(",
")",
")",
";",
"}"
] | Creates an instrumentation-based class injector.
@param folder The folder to be used for storing jar files.
@param target A representation of the target path to which classes are to be appended.
@param instrumentation The instrumentation to use for appending to the class path or the boot path.
@return An appropriate class injector that applies instrumentation. | [
"Creates",
"an",
"instrumentation",
"-",
"based",
"class",
"injector",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java#L2114-L2116 |
22,756 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/OpenedClassReader.java | OpenedClassReader.of | public static ClassReader of(byte[] binaryRepresentation) {
if (EXPERIMENTAL) {
byte[] actualVersion = new byte[]{binaryRepresentation[4], binaryRepresentation[5], binaryRepresentation[6], binaryRepresentation[7]};
binaryRepresentation[4] = (byte) (Opcodes.V12 >>> 24);
binaryRepresentation[5] = (byte) (Opcodes.V12 >>> 16);
binaryRepresentation[6] = (byte) (Opcodes.V12 >>> 8);
binaryRepresentation[7] = (byte) Opcodes.V12;
ClassReader classReader = new ClassReader(binaryRepresentation);
System.arraycopy(actualVersion, 0, binaryRepresentation, 4, actualVersion.length);
return classReader;
} else {
return new ClassReader(binaryRepresentation);
}
} | java | public static ClassReader of(byte[] binaryRepresentation) {
if (EXPERIMENTAL) {
byte[] actualVersion = new byte[]{binaryRepresentation[4], binaryRepresentation[5], binaryRepresentation[6], binaryRepresentation[7]};
binaryRepresentation[4] = (byte) (Opcodes.V12 >>> 24);
binaryRepresentation[5] = (byte) (Opcodes.V12 >>> 16);
binaryRepresentation[6] = (byte) (Opcodes.V12 >>> 8);
binaryRepresentation[7] = (byte) Opcodes.V12;
ClassReader classReader = new ClassReader(binaryRepresentation);
System.arraycopy(actualVersion, 0, binaryRepresentation, 4, actualVersion.length);
return classReader;
} else {
return new ClassReader(binaryRepresentation);
}
} | [
"public",
"static",
"ClassReader",
"of",
"(",
"byte",
"[",
"]",
"binaryRepresentation",
")",
"{",
"if",
"(",
"EXPERIMENTAL",
")",
"{",
"byte",
"[",
"]",
"actualVersion",
"=",
"new",
"byte",
"[",
"]",
"{",
"binaryRepresentation",
"[",
"4",
"]",
",",
"binaryRepresentation",
"[",
"5",
"]",
",",
"binaryRepresentation",
"[",
"6",
"]",
",",
"binaryRepresentation",
"[",
"7",
"]",
"}",
";",
"binaryRepresentation",
"[",
"4",
"]",
"=",
"(",
"byte",
")",
"(",
"Opcodes",
".",
"V12",
">>>",
"24",
")",
";",
"binaryRepresentation",
"[",
"5",
"]",
"=",
"(",
"byte",
")",
"(",
"Opcodes",
".",
"V12",
">>>",
"16",
")",
";",
"binaryRepresentation",
"[",
"6",
"]",
"=",
"(",
"byte",
")",
"(",
"Opcodes",
".",
"V12",
">>>",
"8",
")",
";",
"binaryRepresentation",
"[",
"7",
"]",
"=",
"(",
"byte",
")",
"Opcodes",
".",
"V12",
";",
"ClassReader",
"classReader",
"=",
"new",
"ClassReader",
"(",
"binaryRepresentation",
")",
";",
"System",
".",
"arraycopy",
"(",
"actualVersion",
",",
"0",
",",
"binaryRepresentation",
",",
"4",
",",
"actualVersion",
".",
"length",
")",
";",
"return",
"classReader",
";",
"}",
"else",
"{",
"return",
"new",
"ClassReader",
"(",
"binaryRepresentation",
")",
";",
"}",
"}"
] | Creates a class reader for the given binary representation of a class file.
@param binaryRepresentation The binary representation of a class file to read.
@return An appropriate class reader. | [
"Creates",
"a",
"class",
"reader",
"for",
"the",
"given",
"binary",
"representation",
"of",
"a",
"class",
"file",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/OpenedClassReader.java#L71-L84 |
22,757 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvocationHandlerAdapter.java | InvocationHandlerAdapter.argumentValuesOf | private List<StackManipulation> argumentValuesOf(MethodDescription instrumentedMethod) {
TypeList.Generic parameterTypes = instrumentedMethod.getParameters().asTypeList();
List<StackManipulation> instruction = new ArrayList<StackManipulation>(parameterTypes.size());
int currentIndex = 1;
for (TypeDescription.Generic parameterType : parameterTypes) {
instruction.add(new StackManipulation.Compound(
MethodVariableAccess.of(parameterType).loadFrom(currentIndex),
assigner.assign(parameterType, TypeDescription.Generic.OBJECT, Assigner.Typing.STATIC)));
currentIndex += parameterType.getStackSize().getSize();
}
return instruction;
} | java | private List<StackManipulation> argumentValuesOf(MethodDescription instrumentedMethod) {
TypeList.Generic parameterTypes = instrumentedMethod.getParameters().asTypeList();
List<StackManipulation> instruction = new ArrayList<StackManipulation>(parameterTypes.size());
int currentIndex = 1;
for (TypeDescription.Generic parameterType : parameterTypes) {
instruction.add(new StackManipulation.Compound(
MethodVariableAccess.of(parameterType).loadFrom(currentIndex),
assigner.assign(parameterType, TypeDescription.Generic.OBJECT, Assigner.Typing.STATIC)));
currentIndex += parameterType.getStackSize().getSize();
}
return instruction;
} | [
"private",
"List",
"<",
"StackManipulation",
">",
"argumentValuesOf",
"(",
"MethodDescription",
"instrumentedMethod",
")",
"{",
"TypeList",
".",
"Generic",
"parameterTypes",
"=",
"instrumentedMethod",
".",
"getParameters",
"(",
")",
".",
"asTypeList",
"(",
")",
";",
"List",
"<",
"StackManipulation",
">",
"instruction",
"=",
"new",
"ArrayList",
"<",
"StackManipulation",
">",
"(",
"parameterTypes",
".",
"size",
"(",
")",
")",
";",
"int",
"currentIndex",
"=",
"1",
";",
"for",
"(",
"TypeDescription",
".",
"Generic",
"parameterType",
":",
"parameterTypes",
")",
"{",
"instruction",
".",
"add",
"(",
"new",
"StackManipulation",
".",
"Compound",
"(",
"MethodVariableAccess",
".",
"of",
"(",
"parameterType",
")",
".",
"loadFrom",
"(",
"currentIndex",
")",
",",
"assigner",
".",
"assign",
"(",
"parameterType",
",",
"TypeDescription",
".",
"Generic",
".",
"OBJECT",
",",
"Assigner",
".",
"Typing",
".",
"STATIC",
")",
")",
")",
";",
"currentIndex",
"+=",
"parameterType",
".",
"getStackSize",
"(",
")",
".",
"getSize",
"(",
")",
";",
"}",
"return",
"instruction",
";",
"}"
] | Returns a list of stack manipulations that loads all arguments of an instrumented method.
@param instrumentedMethod The method that is instrumented.
@return A list of stack manipulation that loads all arguments of an instrumented method. | [
"Returns",
"a",
"list",
"of",
"stack",
"manipulations",
"that",
"loads",
"all",
"arguments",
"of",
"an",
"instrumented",
"method",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvocationHandlerAdapter.java#L171-L182 |
22,758 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvocationHandlerAdapter.java | InvocationHandlerAdapter.apply | protected ByteCodeAppender.Size apply(MethodVisitor methodVisitor,
Context implementationContext,
MethodDescription instrumentedMethod,
StackManipulation preparingManipulation,
FieldDescription fieldDescription) {
if (instrumentedMethod.isStatic()) {
throw new IllegalStateException("It is not possible to apply an invocation handler onto the static method " + instrumentedMethod);
}
MethodConstant.CanCache methodConstant = privileged
? MethodConstant.ofPrivileged(instrumentedMethod.asDefined())
: MethodConstant.of(instrumentedMethod.asDefined());
StackManipulation.Size stackSize = new StackManipulation.Compound(
preparingManipulation,
FieldAccess.forField(fieldDescription).read(),
MethodVariableAccess.loadThis(),
cached ? methodConstant.cached() : methodConstant,
ArrayFactory.forType(TypeDescription.Generic.OBJECT).withValues(argumentValuesOf(instrumentedMethod)),
MethodInvocation.invoke(INVOCATION_HANDLER_TYPE.getDeclaredMethods().getOnly()),
assigner.assign(TypeDescription.Generic.OBJECT, instrumentedMethod.getReturnType(), Assigner.Typing.DYNAMIC),
MethodReturn.of(instrumentedMethod.getReturnType())
).apply(methodVisitor, implementationContext);
return new ByteCodeAppender.Size(stackSize.getMaximalSize(), instrumentedMethod.getStackSize());
} | java | protected ByteCodeAppender.Size apply(MethodVisitor methodVisitor,
Context implementationContext,
MethodDescription instrumentedMethod,
StackManipulation preparingManipulation,
FieldDescription fieldDescription) {
if (instrumentedMethod.isStatic()) {
throw new IllegalStateException("It is not possible to apply an invocation handler onto the static method " + instrumentedMethod);
}
MethodConstant.CanCache methodConstant = privileged
? MethodConstant.ofPrivileged(instrumentedMethod.asDefined())
: MethodConstant.of(instrumentedMethod.asDefined());
StackManipulation.Size stackSize = new StackManipulation.Compound(
preparingManipulation,
FieldAccess.forField(fieldDescription).read(),
MethodVariableAccess.loadThis(),
cached ? methodConstant.cached() : methodConstant,
ArrayFactory.forType(TypeDescription.Generic.OBJECT).withValues(argumentValuesOf(instrumentedMethod)),
MethodInvocation.invoke(INVOCATION_HANDLER_TYPE.getDeclaredMethods().getOnly()),
assigner.assign(TypeDescription.Generic.OBJECT, instrumentedMethod.getReturnType(), Assigner.Typing.DYNAMIC),
MethodReturn.of(instrumentedMethod.getReturnType())
).apply(methodVisitor, implementationContext);
return new ByteCodeAppender.Size(stackSize.getMaximalSize(), instrumentedMethod.getStackSize());
} | [
"protected",
"ByteCodeAppender",
".",
"Size",
"apply",
"(",
"MethodVisitor",
"methodVisitor",
",",
"Context",
"implementationContext",
",",
"MethodDescription",
"instrumentedMethod",
",",
"StackManipulation",
"preparingManipulation",
",",
"FieldDescription",
"fieldDescription",
")",
"{",
"if",
"(",
"instrumentedMethod",
".",
"isStatic",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"It is not possible to apply an invocation handler onto the static method \"",
"+",
"instrumentedMethod",
")",
";",
"}",
"MethodConstant",
".",
"CanCache",
"methodConstant",
"=",
"privileged",
"?",
"MethodConstant",
".",
"ofPrivileged",
"(",
"instrumentedMethod",
".",
"asDefined",
"(",
")",
")",
":",
"MethodConstant",
".",
"of",
"(",
"instrumentedMethod",
".",
"asDefined",
"(",
")",
")",
";",
"StackManipulation",
".",
"Size",
"stackSize",
"=",
"new",
"StackManipulation",
".",
"Compound",
"(",
"preparingManipulation",
",",
"FieldAccess",
".",
"forField",
"(",
"fieldDescription",
")",
".",
"read",
"(",
")",
",",
"MethodVariableAccess",
".",
"loadThis",
"(",
")",
",",
"cached",
"?",
"methodConstant",
".",
"cached",
"(",
")",
":",
"methodConstant",
",",
"ArrayFactory",
".",
"forType",
"(",
"TypeDescription",
".",
"Generic",
".",
"OBJECT",
")",
".",
"withValues",
"(",
"argumentValuesOf",
"(",
"instrumentedMethod",
")",
")",
",",
"MethodInvocation",
".",
"invoke",
"(",
"INVOCATION_HANDLER_TYPE",
".",
"getDeclaredMethods",
"(",
")",
".",
"getOnly",
"(",
")",
")",
",",
"assigner",
".",
"assign",
"(",
"TypeDescription",
".",
"Generic",
".",
"OBJECT",
",",
"instrumentedMethod",
".",
"getReturnType",
"(",
")",
",",
"Assigner",
".",
"Typing",
".",
"DYNAMIC",
")",
",",
"MethodReturn",
".",
"of",
"(",
"instrumentedMethod",
".",
"getReturnType",
"(",
")",
")",
")",
".",
"apply",
"(",
"methodVisitor",
",",
"implementationContext",
")",
";",
"return",
"new",
"ByteCodeAppender",
".",
"Size",
"(",
"stackSize",
".",
"getMaximalSize",
"(",
")",
",",
"instrumentedMethod",
".",
"getStackSize",
"(",
")",
")",
";",
"}"
] | Applies an implementation that delegates to a invocation handler.
@param methodVisitor The method visitor for writing the byte code to.
@param implementationContext The implementation context for the current implementation.
@param instrumentedMethod The method that is instrumented.
@param preparingManipulation A stack manipulation that applies any preparation to the operand stack.
@param fieldDescription The field that contains the value for the invocation handler.
@return The size of the applied assignment. | [
"Applies",
"an",
"implementation",
"that",
"delegates",
"to",
"a",
"invocation",
"handler",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvocationHandlerAdapter.java#L218-L240 |
22,759 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/asm/TypeReferenceAdjustment.java | TypeReferenceAdjustment.filter | public TypeReferenceAdjustment filter(ElementMatcher<? super TypeDescription> filter) {
return new TypeReferenceAdjustment(strict, this.filter.<TypeDescription>or(filter));
} | java | public TypeReferenceAdjustment filter(ElementMatcher<? super TypeDescription> filter) {
return new TypeReferenceAdjustment(strict, this.filter.<TypeDescription>or(filter));
} | [
"public",
"TypeReferenceAdjustment",
"filter",
"(",
"ElementMatcher",
"<",
"?",
"super",
"TypeDescription",
">",
"filter",
")",
"{",
"return",
"new",
"TypeReferenceAdjustment",
"(",
"strict",
",",
"this",
".",
"filter",
".",
"<",
"TypeDescription",
">",
"or",
"(",
"filter",
")",
")",
";",
"}"
] | Excludes all matched types from being added as an attribute.
@param filter A filter for excluding types from the attribute generation.
@return A new type reference adjustment that uses the supplied filter for excluding types. | [
"Excludes",
"all",
"matched",
"types",
"from",
"being",
"added",
"as",
"an",
"attribute",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/TypeReferenceAdjustment.java#L91-L93 |
22,760 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/InstanceCheck.java | InstanceCheck.of | public static StackManipulation of(TypeDescription typeDescription) {
if (typeDescription.isPrimitive()) {
throw new IllegalArgumentException("Cannot check an instance against a primitive type: " + typeDescription);
}
return new InstanceCheck(typeDescription);
} | java | public static StackManipulation of(TypeDescription typeDescription) {
if (typeDescription.isPrimitive()) {
throw new IllegalArgumentException("Cannot check an instance against a primitive type: " + typeDescription);
}
return new InstanceCheck(typeDescription);
} | [
"public",
"static",
"StackManipulation",
"of",
"(",
"TypeDescription",
"typeDescription",
")",
"{",
"if",
"(",
"typeDescription",
".",
"isPrimitive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot check an instance against a primitive type: \"",
"+",
"typeDescription",
")",
";",
"}",
"return",
"new",
"InstanceCheck",
"(",
"typeDescription",
")",
";",
"}"
] | Creates a new instance check.
@param typeDescription The type to apply the instance check against.
@return An appropriate stack manipulation. | [
"Creates",
"a",
"new",
"instance",
"check",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/assign/InstanceCheck.java#L51-L56 |
22,761 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/CachingMatcher.java | CachingMatcher.onCacheMiss | protected boolean onCacheMiss(T target) {
boolean cached = matcher.matches(target);
map.put(target, cached);
return cached;
} | java | protected boolean onCacheMiss(T target) {
boolean cached = matcher.matches(target);
map.put(target, cached);
return cached;
} | [
"protected",
"boolean",
"onCacheMiss",
"(",
"T",
"target",
")",
"{",
"boolean",
"cached",
"=",
"matcher",
".",
"matches",
"(",
"target",
")",
";",
"map",
".",
"put",
"(",
"target",
",",
"cached",
")",
";",
"return",
"cached",
";",
"}"
] | Invoked if the cache is not hit.
@param target The element to be matched.
@return {@code true} if the element is matched. | [
"Invoked",
"if",
"the",
"cache",
"is",
"not",
"hit",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/CachingMatcher.java#L72-L76 |
22,762 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/RandomString.java | RandomString.hashOf | public static String hashOf(int value) {
char[] buffer = new char[(Integer.SIZE / KEY_BITS) + ((Integer.SIZE % KEY_BITS) == 0 ? 0 : 1)];
for (int index = 0; index < buffer.length; index++) {
buffer[index] = SYMBOL[(value >>> index * KEY_BITS) & (-1 >>> (Integer.SIZE - KEY_BITS))];
}
return new String(buffer);
} | java | public static String hashOf(int value) {
char[] buffer = new char[(Integer.SIZE / KEY_BITS) + ((Integer.SIZE % KEY_BITS) == 0 ? 0 : 1)];
for (int index = 0; index < buffer.length; index++) {
buffer[index] = SYMBOL[(value >>> index * KEY_BITS) & (-1 >>> (Integer.SIZE - KEY_BITS))];
}
return new String(buffer);
} | [
"public",
"static",
"String",
"hashOf",
"(",
"int",
"value",
")",
"{",
"char",
"[",
"]",
"buffer",
"=",
"new",
"char",
"[",
"(",
"Integer",
".",
"SIZE",
"/",
"KEY_BITS",
")",
"+",
"(",
"(",
"Integer",
".",
"SIZE",
"%",
"KEY_BITS",
")",
"==",
"0",
"?",
"0",
":",
"1",
")",
"]",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"buffer",
".",
"length",
";",
"index",
"++",
")",
"{",
"buffer",
"[",
"index",
"]",
"=",
"SYMBOL",
"[",
"(",
"value",
">>>",
"index",
"*",
"KEY_BITS",
")",
"&",
"(",
"-",
"1",
">>>",
"(",
"Integer",
".",
"SIZE",
"-",
"KEY_BITS",
")",
")",
"]",
";",
"}",
"return",
"new",
"String",
"(",
"buffer",
")",
";",
"}"
] | Represents an integer value as a string hash. This string is not technically random but generates a fixed character
sequence based on the hash provided.
@param value The value to represent as a string.
@return A string representing the supplied value as a string. | [
"Represents",
"an",
"integer",
"value",
"as",
"a",
"string",
"hash",
".",
"This",
"string",
"is",
"not",
"technically",
"random",
"but",
"generates",
"a",
"fixed",
"character",
"sequence",
"based",
"on",
"the",
"hash",
"provided",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/RandomString.java#L116-L122 |
22,763 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/MethodConstant.java | MethodConstant.of | public static CanCache of(MethodDescription.InDefinedShape methodDescription) {
if (methodDescription.isTypeInitializer()) {
return CanCacheIllegal.INSTANCE;
} else if (methodDescription.isConstructor()) {
return new ForConstructor(methodDescription);
} else {
return new ForMethod(methodDescription);
}
} | java | public static CanCache of(MethodDescription.InDefinedShape methodDescription) {
if (methodDescription.isTypeInitializer()) {
return CanCacheIllegal.INSTANCE;
} else if (methodDescription.isConstructor()) {
return new ForConstructor(methodDescription);
} else {
return new ForMethod(methodDescription);
}
} | [
"public",
"static",
"CanCache",
"of",
"(",
"MethodDescription",
".",
"InDefinedShape",
"methodDescription",
")",
"{",
"if",
"(",
"methodDescription",
".",
"isTypeInitializer",
"(",
")",
")",
"{",
"return",
"CanCacheIllegal",
".",
"INSTANCE",
";",
"}",
"else",
"if",
"(",
"methodDescription",
".",
"isConstructor",
"(",
")",
")",
"{",
"return",
"new",
"ForConstructor",
"(",
"methodDescription",
")",
";",
"}",
"else",
"{",
"return",
"new",
"ForMethod",
"(",
"methodDescription",
")",
";",
"}",
"}"
] | Creates a stack manipulation that loads a method constant onto the operand stack.
@param methodDescription The method to be loaded onto the stack.
@return A stack manipulation that assigns a method constant for the given method description. | [
"Creates",
"a",
"stack",
"manipulation",
"that",
"loads",
"a",
"method",
"constant",
"onto",
"the",
"operand",
"stack",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/MethodConstant.java#L67-L75 |
22,764 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/MethodConstant.java | MethodConstant.typeConstantsFor | protected static List<StackManipulation> typeConstantsFor(List<TypeDescription> parameterTypes) {
List<StackManipulation> typeConstants = new ArrayList<StackManipulation>(parameterTypes.size());
for (TypeDescription parameterType : parameterTypes) {
typeConstants.add(ClassConstant.of(parameterType));
}
return typeConstants;
} | java | protected static List<StackManipulation> typeConstantsFor(List<TypeDescription> parameterTypes) {
List<StackManipulation> typeConstants = new ArrayList<StackManipulation>(parameterTypes.size());
for (TypeDescription parameterType : parameterTypes) {
typeConstants.add(ClassConstant.of(parameterType));
}
return typeConstants;
} | [
"protected",
"static",
"List",
"<",
"StackManipulation",
">",
"typeConstantsFor",
"(",
"List",
"<",
"TypeDescription",
">",
"parameterTypes",
")",
"{",
"List",
"<",
"StackManipulation",
">",
"typeConstants",
"=",
"new",
"ArrayList",
"<",
"StackManipulation",
">",
"(",
"parameterTypes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"TypeDescription",
"parameterType",
":",
"parameterTypes",
")",
"{",
"typeConstants",
".",
"add",
"(",
"ClassConstant",
".",
"of",
"(",
"parameterType",
")",
")",
";",
"}",
"return",
"typeConstants",
";",
"}"
] | Returns a list of type constant load operations for the given list of parameters.
@param parameterTypes A list of all type descriptions that should be represented as type constant
load operations.
@return A corresponding list of type constant load operations. | [
"Returns",
"a",
"list",
"of",
"type",
"constant",
"load",
"operations",
"for",
"the",
"given",
"list",
"of",
"parameters",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/MethodConstant.java#L100-L106 |
22,765 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java | TypeCache.insert | @SuppressFBWarnings(value = "GC_UNRELATED_TYPES", justification = "Cross-comparison is intended")
public Class<?> insert(ClassLoader classLoader, T key, Class<?> type) {
ConcurrentMap<T, Reference<Class<?>>> storage = cache.get(new LookupKey(classLoader));
if (storage == null) {
storage = new ConcurrentHashMap<T, Reference<Class<?>>>();
ConcurrentMap<T, Reference<Class<?>>> previous = cache.putIfAbsent(new StorageKey(classLoader, this), storage);
if (previous != null) {
storage = previous;
}
}
Reference<Class<?>> reference = sort.wrap(type), previous = storage.putIfAbsent(key, reference);
while (previous != null) {
Class<?> previousType = previous.get();
if (previousType != null) {
return previousType;
} else if (storage.remove(key, previous)) {
previous = storage.putIfAbsent(key, reference);
} else {
previous = storage.get(key);
if (previous == null) {
previous = storage.putIfAbsent(key, reference);
}
}
}
return type;
} | java | @SuppressFBWarnings(value = "GC_UNRELATED_TYPES", justification = "Cross-comparison is intended")
public Class<?> insert(ClassLoader classLoader, T key, Class<?> type) {
ConcurrentMap<T, Reference<Class<?>>> storage = cache.get(new LookupKey(classLoader));
if (storage == null) {
storage = new ConcurrentHashMap<T, Reference<Class<?>>>();
ConcurrentMap<T, Reference<Class<?>>> previous = cache.putIfAbsent(new StorageKey(classLoader, this), storage);
if (previous != null) {
storage = previous;
}
}
Reference<Class<?>> reference = sort.wrap(type), previous = storage.putIfAbsent(key, reference);
while (previous != null) {
Class<?> previousType = previous.get();
if (previousType != null) {
return previousType;
} else if (storage.remove(key, previous)) {
previous = storage.putIfAbsent(key, reference);
} else {
previous = storage.get(key);
if (previous == null) {
previous = storage.putIfAbsent(key, reference);
}
}
}
return type;
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"GC_UNRELATED_TYPES\"",
",",
"justification",
"=",
"\"Cross-comparison is intended\"",
")",
"public",
"Class",
"<",
"?",
">",
"insert",
"(",
"ClassLoader",
"classLoader",
",",
"T",
"key",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"ConcurrentMap",
"<",
"T",
",",
"Reference",
"<",
"Class",
"<",
"?",
">",
">",
">",
"storage",
"=",
"cache",
".",
"get",
"(",
"new",
"LookupKey",
"(",
"classLoader",
")",
")",
";",
"if",
"(",
"storage",
"==",
"null",
")",
"{",
"storage",
"=",
"new",
"ConcurrentHashMap",
"<",
"T",
",",
"Reference",
"<",
"Class",
"<",
"?",
">",
">",
">",
"(",
")",
";",
"ConcurrentMap",
"<",
"T",
",",
"Reference",
"<",
"Class",
"<",
"?",
">",
">",
">",
"previous",
"=",
"cache",
".",
"putIfAbsent",
"(",
"new",
"StorageKey",
"(",
"classLoader",
",",
"this",
")",
",",
"storage",
")",
";",
"if",
"(",
"previous",
"!=",
"null",
")",
"{",
"storage",
"=",
"previous",
";",
"}",
"}",
"Reference",
"<",
"Class",
"<",
"?",
">",
">",
"reference",
"=",
"sort",
".",
"wrap",
"(",
"type",
")",
",",
"previous",
"=",
"storage",
".",
"putIfAbsent",
"(",
"key",
",",
"reference",
")",
";",
"while",
"(",
"previous",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"previousType",
"=",
"previous",
".",
"get",
"(",
")",
";",
"if",
"(",
"previousType",
"!=",
"null",
")",
"{",
"return",
"previousType",
";",
"}",
"else",
"if",
"(",
"storage",
".",
"remove",
"(",
"key",
",",
"previous",
")",
")",
"{",
"previous",
"=",
"storage",
".",
"putIfAbsent",
"(",
"key",
",",
"reference",
")",
";",
"}",
"else",
"{",
"previous",
"=",
"storage",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"previous",
"==",
"null",
")",
"{",
"previous",
"=",
"storage",
".",
"putIfAbsent",
"(",
"key",
",",
"reference",
")",
";",
"}",
"}",
"}",
"return",
"type",
";",
"}"
] | Inserts a new type into the cache. If a type with the same class loader and key was inserted previously, the cache is not updated.
@param classLoader The class loader for which this type is stored.
@param key The key for the type in question.
@param type The type to insert of no previous type was stored in the cache.
@return The supplied type or a previously submitted type for the same class loader and key combination. | [
"Inserts",
"a",
"new",
"type",
"into",
"the",
"cache",
".",
"If",
"a",
"type",
"with",
"the",
"same",
"class",
"loader",
"and",
"key",
"was",
"inserted",
"previously",
"the",
"cache",
"is",
"not",
"updated",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/TypeCache.java#L111-L136 |
22,766 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java | SuperClassInvocationBenchmark.benchmarkByteBuddyWithProxy | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddyWithProxy(Blackhole blackHole) {
blackHole.consume(byteBuddyWithProxyInstance.method(booleanValue));
blackHole.consume(byteBuddyWithProxyInstance.method(byteValue));
blackHole.consume(byteBuddyWithProxyInstance.method(shortValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(charValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(longValue));
blackHole.consume(byteBuddyWithProxyInstance.method(floatValue));
blackHole.consume(byteBuddyWithProxyInstance.method(doubleValue));
blackHole.consume(byteBuddyWithProxyInstance.method(stringValue));
blackHole.consume(byteBuddyWithProxyInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddyWithProxyInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddyWithProxyInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddyWithProxyInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddyWithProxyInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddyWithProxyInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddyWithProxy(Blackhole blackHole) {
blackHole.consume(byteBuddyWithProxyInstance.method(booleanValue));
blackHole.consume(byteBuddyWithProxyInstance.method(byteValue));
blackHole.consume(byteBuddyWithProxyInstance.method(shortValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(charValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(longValue));
blackHole.consume(byteBuddyWithProxyInstance.method(floatValue));
blackHole.consume(byteBuddyWithProxyInstance.method(doubleValue));
blackHole.consume(byteBuddyWithProxyInstance.method(stringValue));
blackHole.consume(byteBuddyWithProxyInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddyWithProxyInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddyWithProxyInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddyWithProxyInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithProxyInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddyWithProxyInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddyWithProxyInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddyWithProxyInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"benchmarkByteBuddyWithProxy",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithProxyInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark of a super method invocation using Byte Buddy. This benchmark uses an annotation-based
approach which is more difficult to optimize by the JIT compiler.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"super",
"method",
"invocation",
"using",
"Byte",
"Buddy",
".",
"This",
"benchmark",
"uses",
"an",
"annotation",
"-",
"based",
"approach",
"which",
"is",
"more",
"difficult",
"to",
"optimize",
"by",
"the",
"JIT",
"compiler",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java#L178-L201 |
22,767 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java | SuperClassInvocationBenchmark.benchmarkByteBuddyWithAccessor | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddyWithAccessor(Blackhole blackHole) {
blackHole.consume(byteBuddyWithAccessorInstance.method(booleanValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(byteValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(shortValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(charValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(longValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(floatValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(doubleValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(stringValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddyWithAccessor(Blackhole blackHole) {
blackHole.consume(byteBuddyWithAccessorInstance.method(booleanValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(byteValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(shortValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(charValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(longValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(floatValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(doubleValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(stringValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddyWithAccessorInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"benchmarkByteBuddyWithAccessor",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithAccessorInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark of a super method invocation using Byte Buddy. This benchmark also uses the annotation-based approach
but creates delegation methods which do not require the creation of additional classes.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"super",
"method",
"invocation",
"using",
"Byte",
"Buddy",
".",
"This",
"benchmark",
"also",
"uses",
"the",
"annotation",
"-",
"based",
"approach",
"but",
"creates",
"delegation",
"methods",
"which",
"do",
"not",
"require",
"the",
"creation",
"of",
"additional",
"classes",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java#L209-L232 |
22,768 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java | SuperClassInvocationBenchmark.benchmarkByteBuddyWithPrefix | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddyWithPrefix(Blackhole blackHole) {
blackHole.consume(byteBuddyWithPrefixInstance.method(booleanValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(byteValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(shortValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(charValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(longValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(floatValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(doubleValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(stringValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddyWithPrefix(Blackhole blackHole) {
blackHole.consume(byteBuddyWithPrefixInstance.method(booleanValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(byteValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(shortValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(charValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(longValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(floatValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(doubleValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(stringValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddyWithPrefixInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"benchmarkByteBuddyWithPrefix",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddyWithPrefixInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark of a super method invocation using Byte Buddy. This benchmark also uses the annotation-based approach
but hard-codes the super method call subsequently to the method.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"super",
"method",
"invocation",
"using",
"Byte",
"Buddy",
".",
"This",
"benchmark",
"also",
"uses",
"the",
"annotation",
"-",
"based",
"approach",
"but",
"hard",
"-",
"codes",
"the",
"super",
"method",
"call",
"subsequently",
"to",
"the",
"method",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java#L240-L263 |
22,769 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java | SuperClassInvocationBenchmark.benchmarkByteBuddySpecialized | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddySpecialized(Blackhole blackHole) {
blackHole.consume(byteBuddySpecializedInstance.method(booleanValue));
blackHole.consume(byteBuddySpecializedInstance.method(byteValue));
blackHole.consume(byteBuddySpecializedInstance.method(shortValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue));
blackHole.consume(byteBuddySpecializedInstance.method(charValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue));
blackHole.consume(byteBuddySpecializedInstance.method(longValue));
blackHole.consume(byteBuddySpecializedInstance.method(floatValue));
blackHole.consume(byteBuddySpecializedInstance.method(doubleValue));
blackHole.consume(byteBuddySpecializedInstance.method(stringValue));
blackHole.consume(byteBuddySpecializedInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddySpecializedInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddySpecializedInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddySpecializedInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddySpecializedInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddySpecializedInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddySpecializedInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddySpecializedInstance.method(stringValue, stringValue, stringValue));
} | java | @Benchmark
@OperationsPerInvocation(20)
public void benchmarkByteBuddySpecialized(Blackhole blackHole) {
blackHole.consume(byteBuddySpecializedInstance.method(booleanValue));
blackHole.consume(byteBuddySpecializedInstance.method(byteValue));
blackHole.consume(byteBuddySpecializedInstance.method(shortValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue));
blackHole.consume(byteBuddySpecializedInstance.method(charValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue));
blackHole.consume(byteBuddySpecializedInstance.method(longValue));
blackHole.consume(byteBuddySpecializedInstance.method(floatValue));
blackHole.consume(byteBuddySpecializedInstance.method(doubleValue));
blackHole.consume(byteBuddySpecializedInstance.method(stringValue));
blackHole.consume(byteBuddySpecializedInstance.method(booleanValue, booleanValue, booleanValue));
blackHole.consume(byteBuddySpecializedInstance.method(byteValue, byteValue, byteValue));
blackHole.consume(byteBuddySpecializedInstance.method(shortValue, shortValue, shortValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddySpecializedInstance.method(charValue, charValue, charValue));
blackHole.consume(byteBuddySpecializedInstance.method(intValue, intValue, intValue));
blackHole.consume(byteBuddySpecializedInstance.method(longValue, longValue, longValue));
blackHole.consume(byteBuddySpecializedInstance.method(floatValue, floatValue, floatValue));
blackHole.consume(byteBuddySpecializedInstance.method(doubleValue, doubleValue, doubleValue));
blackHole.consume(byteBuddySpecializedInstance.method(stringValue, stringValue, stringValue));
} | [
"@",
"Benchmark",
"@",
"OperationsPerInvocation",
"(",
"20",
")",
"public",
"void",
"benchmarkByteBuddySpecialized",
"(",
"Blackhole",
"blackHole",
")",
"{",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"stringValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"booleanValue",
",",
"booleanValue",
",",
"booleanValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"byteValue",
",",
"byteValue",
",",
"byteValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"shortValue",
",",
"shortValue",
",",
"shortValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"charValue",
",",
"charValue",
",",
"charValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"intValue",
",",
"intValue",
",",
"intValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"longValue",
",",
"longValue",
",",
"longValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"floatValue",
",",
"floatValue",
",",
"floatValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"doubleValue",
",",
"doubleValue",
",",
"doubleValue",
")",
")",
";",
"blackHole",
".",
"consume",
"(",
"byteBuddySpecializedInstance",
".",
"method",
"(",
"stringValue",
",",
"stringValue",
",",
"stringValue",
")",
")",
";",
"}"
] | Performs a benchmark of a super method invocation using Byte Buddy. This benchmark uses a specialized
interception strategy which is easier to inline by the compiler.
@param blackHole A black hole for avoiding JIT erasure. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"super",
"method",
"invocation",
"using",
"Byte",
"Buddy",
".",
"This",
"benchmark",
"uses",
"a",
"specialized",
"interception",
"strategy",
"which",
"is",
"easier",
"to",
"inline",
"by",
"the",
"compiler",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/SuperClassInvocationBenchmark.java#L271-L294 |
22,770 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java | WithoutSpecification.replaceWithField | public MemberSubstitution replaceWithField(ElementMatcher<? super FieldDescription> matcher) {
return replaceWith(new Substitution.ForFieldAccess.OfMatchedField(matcher));
} | java | public MemberSubstitution replaceWithField(ElementMatcher<? super FieldDescription> matcher) {
return replaceWith(new Substitution.ForFieldAccess.OfMatchedField(matcher));
} | [
"public",
"MemberSubstitution",
"replaceWithField",
"(",
"ElementMatcher",
"<",
"?",
"super",
"FieldDescription",
">",
"matcher",
")",
"{",
"return",
"replaceWith",
"(",
"new",
"Substitution",
".",
"ForFieldAccess",
".",
"OfMatchedField",
"(",
"matcher",
")",
")",
";",
"}"
] | Replaces any interaction with a matched byte code element with a non-static field access on the first
parameter of the matched element. When matching a non-static field access or method invocation, the
substituted field is located on the same receiver type as the original access. For static access, the
first argument is used as a receiver.
@param matcher A matcher for locating a field on the original interaction's receiver type.
@return A member substitution that replaces any matched byte code element with an access of the matched field. | [
"Replaces",
"any",
"interaction",
"with",
"a",
"matched",
"byte",
"code",
"element",
"with",
"a",
"non",
"-",
"static",
"field",
"access",
"on",
"the",
"first",
"parameter",
"of",
"the",
"matched",
"element",
".",
"When",
"matching",
"a",
"non",
"-",
"static",
"field",
"access",
"or",
"method",
"invocation",
"the",
"substituted",
"field",
"is",
"located",
"on",
"the",
"same",
"receiver",
"type",
"as",
"the",
"original",
"access",
".",
"For",
"static",
"access",
"the",
"first",
"argument",
"is",
"used",
"as",
"a",
"receiver",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java#L340-L342 |
22,771 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java | WithoutSpecification.replaceWithMethod | public MemberSubstitution replaceWithMethod(ElementMatcher<? super MethodDescription> matcher, MethodGraph.Compiler methodGraphCompiler) {
return replaceWith(new Substitution.ForMethodInvocation.OfMatchedMethod(matcher, methodGraphCompiler));
} | java | public MemberSubstitution replaceWithMethod(ElementMatcher<? super MethodDescription> matcher, MethodGraph.Compiler methodGraphCompiler) {
return replaceWith(new Substitution.ForMethodInvocation.OfMatchedMethod(matcher, methodGraphCompiler));
} | [
"public",
"MemberSubstitution",
"replaceWithMethod",
"(",
"ElementMatcher",
"<",
"?",
"super",
"MethodDescription",
">",
"matcher",
",",
"MethodGraph",
".",
"Compiler",
"methodGraphCompiler",
")",
"{",
"return",
"replaceWith",
"(",
"new",
"Substitution",
".",
"ForMethodInvocation",
".",
"OfMatchedMethod",
"(",
"matcher",
",",
"methodGraphCompiler",
")",
")",
";",
"}"
] | Replaces any interaction with a matched byte code element with a non-static method access on the first
parameter of the matched element. When matching a non-static field access or method invocation, the
substituted method is located on the same receiver type as the original access. For static access, the
first argument is used as a receiver.
@param matcher A matcher for locating a method on the original interaction's receiver type.
@param methodGraphCompiler The method graph compiler to use for locating a method.
@return A member substitution that replaces any matched byte code element with an access of the matched method. | [
"Replaces",
"any",
"interaction",
"with",
"a",
"matched",
"byte",
"code",
"element",
"with",
"a",
"non",
"-",
"static",
"method",
"access",
"on",
"the",
"first",
"parameter",
"of",
"the",
"matched",
"element",
".",
"When",
"matching",
"a",
"non",
"-",
"static",
"field",
"access",
"or",
"method",
"invocation",
"the",
"substituted",
"method",
"is",
"located",
"on",
"the",
"same",
"receiver",
"type",
"as",
"the",
"original",
"access",
".",
"For",
"static",
"access",
"the",
"first",
"argument",
"is",
"used",
"as",
"a",
"receiver",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java#L409-L411 |
22,772 | raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/PluginArgument.java | PluginArgument.toArgumentResolver | public Plugin.Factory.UsingReflection.ArgumentResolver toArgumentResolver() {
return new Plugin.Factory.UsingReflection.ArgumentResolver.ForIndex.WithDynamicType(index, value);
} | java | public Plugin.Factory.UsingReflection.ArgumentResolver toArgumentResolver() {
return new Plugin.Factory.UsingReflection.ArgumentResolver.ForIndex.WithDynamicType(index, value);
} | [
"public",
"Plugin",
".",
"Factory",
".",
"UsingReflection",
".",
"ArgumentResolver",
"toArgumentResolver",
"(",
")",
"{",
"return",
"new",
"Plugin",
".",
"Factory",
".",
"UsingReflection",
".",
"ArgumentResolver",
".",
"ForIndex",
".",
"WithDynamicType",
"(",
"index",
",",
"value",
")",
";",
"}"
] | Resolves this plugin argument to an argument resolver.
@return An argument resolver that represents this plugin argument. | [
"Resolves",
"this",
"plugin",
"argument",
"to",
"an",
"argument",
"resolver",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/PluginArgument.java#L42-L44 |
22,773 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java | CompoundList.of | public static <S> List<S> of(S left, List<? extends S> right) {
if (right.isEmpty()) {
return Collections.singletonList(left);
} else {
List<S> list = new ArrayList<S>(1 + right.size());
list.add(left);
list.addAll(right);
return list;
}
} | java | public static <S> List<S> of(S left, List<? extends S> right) {
if (right.isEmpty()) {
return Collections.singletonList(left);
} else {
List<S> list = new ArrayList<S>(1 + right.size());
list.add(left);
list.addAll(right);
return list;
}
} | [
"public",
"static",
"<",
"S",
">",
"List",
"<",
"S",
">",
"of",
"(",
"S",
"left",
",",
"List",
"<",
"?",
"extends",
"S",
">",
"right",
")",
"{",
"if",
"(",
"right",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"singletonList",
"(",
"left",
")",
";",
"}",
"else",
"{",
"List",
"<",
"S",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"S",
">",
"(",
"1",
"+",
"right",
".",
"size",
"(",
")",
")",
";",
"list",
".",
"add",
"(",
"left",
")",
";",
"list",
".",
"addAll",
"(",
"right",
")",
";",
"return",
"list",
";",
"}",
"}"
] | Creates a list of a single element and another list.
@param left The left element.
@param right The right list.
@param <S> The type of the list's elements.
@return A compound list representing the element and the list. | [
"Creates",
"a",
"list",
"of",
"a",
"single",
"element",
"and",
"another",
"list",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java#L42-L51 |
22,774 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java | CompoundList.of | public static <S> List<S> of(List<? extends S> left, List<? extends S> right) {
List<S> list = new ArrayList<S>(left.size() + right.size());
list.addAll(left);
list.addAll(right);
return list;
} | java | public static <S> List<S> of(List<? extends S> left, List<? extends S> right) {
List<S> list = new ArrayList<S>(left.size() + right.size());
list.addAll(left);
list.addAll(right);
return list;
} | [
"public",
"static",
"<",
"S",
">",
"List",
"<",
"S",
">",
"of",
"(",
"List",
"<",
"?",
"extends",
"S",
">",
"left",
",",
"List",
"<",
"?",
"extends",
"S",
">",
"right",
")",
"{",
"List",
"<",
"S",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"S",
">",
"(",
"left",
".",
"size",
"(",
")",
"+",
"right",
".",
"size",
"(",
")",
")",
";",
"list",
".",
"addAll",
"(",
"left",
")",
";",
"list",
".",
"addAll",
"(",
"right",
")",
";",
"return",
"list",
";",
"}"
] | Creates a list of a left and right list.
@param left The left list.
@param right The right list.
@param <S> The type of the list's elements.
@return A compound list representing the elements of both lists. | [
"Creates",
"a",
"list",
"of",
"a",
"left",
"and",
"right",
"list",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/CompoundList.java#L80-L85 |
22,775 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeDescription.java | ForSignatureVisitor.onOwnableType | private void onOwnableType(Generic ownableType) {
Generic ownerType = ownableType.getOwnerType();
if (ownerType != null && ownerType.getSort().isParameterized()) {
onOwnableType(ownerType);
signatureVisitor.visitInnerClassType(ownableType.asErasure().getSimpleName());
} else {
signatureVisitor.visitClassType(ownableType.asErasure().getInternalName());
}
for (Generic typeArgument : ownableType.getTypeArguments()) {
typeArgument.accept(new OfTypeArgument(signatureVisitor));
}
} | java | private void onOwnableType(Generic ownableType) {
Generic ownerType = ownableType.getOwnerType();
if (ownerType != null && ownerType.getSort().isParameterized()) {
onOwnableType(ownerType);
signatureVisitor.visitInnerClassType(ownableType.asErasure().getSimpleName());
} else {
signatureVisitor.visitClassType(ownableType.asErasure().getInternalName());
}
for (Generic typeArgument : ownableType.getTypeArguments()) {
typeArgument.accept(new OfTypeArgument(signatureVisitor));
}
} | [
"private",
"void",
"onOwnableType",
"(",
"Generic",
"ownableType",
")",
"{",
"Generic",
"ownerType",
"=",
"ownableType",
".",
"getOwnerType",
"(",
")",
";",
"if",
"(",
"ownerType",
"!=",
"null",
"&&",
"ownerType",
".",
"getSort",
"(",
")",
".",
"isParameterized",
"(",
")",
")",
"{",
"onOwnableType",
"(",
"ownerType",
")",
";",
"signatureVisitor",
".",
"visitInnerClassType",
"(",
"ownableType",
".",
"asErasure",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"else",
"{",
"signatureVisitor",
".",
"visitClassType",
"(",
"ownableType",
".",
"asErasure",
"(",
")",
".",
"getInternalName",
"(",
")",
")",
";",
"}",
"for",
"(",
"Generic",
"typeArgument",
":",
"ownableType",
".",
"getTypeArguments",
"(",
")",
")",
"{",
"typeArgument",
".",
"accept",
"(",
"new",
"OfTypeArgument",
"(",
"signatureVisitor",
")",
")",
";",
"}",
"}"
] | Visits a type which might define an owner type.
@param ownableType The visited generic type. | [
"Visits",
"a",
"type",
"which",
"might",
"define",
"an",
"owner",
"type",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/description/type/TypeDescription.java#L1705-L1716 |
22,776 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/SerializedConstant.java | SerializedConstant.of | public static StackManipulation of(Serializable value) {
if (value == null) {
return NullConstant.INSTANCE;
}
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
try {
objectOutputStream.writeObject(value);
} finally {
objectOutputStream.close();
}
return new SerializedConstant(byteArrayOutputStream.toString(CHARSET));
} catch (IOException exception) {
throw new IllegalStateException("Cannot serialize " + value, exception);
}
} | java | public static StackManipulation of(Serializable value) {
if (value == null) {
return NullConstant.INSTANCE;
}
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
try {
objectOutputStream.writeObject(value);
} finally {
objectOutputStream.close();
}
return new SerializedConstant(byteArrayOutputStream.toString(CHARSET));
} catch (IOException exception) {
throw new IllegalStateException("Cannot serialize " + value, exception);
}
} | [
"public",
"static",
"StackManipulation",
"of",
"(",
"Serializable",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"NullConstant",
".",
"INSTANCE",
";",
"}",
"try",
"{",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"objectOutputStream",
"=",
"new",
"ObjectOutputStream",
"(",
"byteArrayOutputStream",
")",
";",
"try",
"{",
"objectOutputStream",
".",
"writeObject",
"(",
"value",
")",
";",
"}",
"finally",
"{",
"objectOutputStream",
".",
"close",
"(",
")",
";",
"}",
"return",
"new",
"SerializedConstant",
"(",
"byteArrayOutputStream",
".",
"toString",
"(",
"CHARSET",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot serialize \"",
"+",
"value",
",",
"exception",
")",
";",
"}",
"}"
] | Creates a new stack manipulation to load the supplied value onto the stack.
@param value The value to serialize.
@return A stack manipulation to serialize the supplied value. | [
"Creates",
"a",
"new",
"stack",
"manipulation",
"to",
"load",
"the",
"supplied",
"value",
"onto",
"the",
"stack",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/bytecode/constant/SerializedConstant.java#L61-L77 |
22,777 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaModule.java | JavaModule.addReads | public void addReads(Instrumentation instrumentation, JavaModule module) {
DISPATCHER.addReads(instrumentation, this.module, module.unwrap());
} | java | public void addReads(Instrumentation instrumentation, JavaModule module) {
DISPATCHER.addReads(instrumentation, this.module, module.unwrap());
} | [
"public",
"void",
"addReads",
"(",
"Instrumentation",
"instrumentation",
",",
"JavaModule",
"module",
")",
"{",
"DISPATCHER",
".",
"addReads",
"(",
"instrumentation",
",",
"this",
".",
"module",
",",
"module",
".",
"unwrap",
"(",
")",
")",
";",
"}"
] | Adds a read-edge to this module to the supplied module using the instrumentation API.
@param instrumentation The instrumentation instance to use for adding the edge.
@param module The module to add as a read dependency to this module. | [
"Adds",
"a",
"read",
"-",
"edge",
"to",
"this",
"module",
"to",
"the",
"supplied",
"module",
"using",
"the",
"instrumentation",
"API",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaModule.java#L152-L154 |
22,778 | raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Initialization.java | Initialization.getEntryPoint | public EntryPoint getEntryPoint(ClassLoaderResolver classLoaderResolver, File root, Iterable<? extends File> classPath) {
if (entryPoint == null || entryPoint.length() == 0) {
throw new GradleException("Entry point name is not defined");
}
for (EntryPoint.Default entryPoint : EntryPoint.Default.values()) {
if (this.entryPoint.equals(entryPoint.name())) {
return entryPoint;
}
}
try {
return (EntryPoint) Class.forName(entryPoint, false, classLoaderResolver.resolve(getClassPath(root, classPath)))
.getDeclaredConstructor()
.newInstance();
} catch (Exception exception) {
throw new GradleException("Cannot create entry point: " + entryPoint, exception);
}
} | java | public EntryPoint getEntryPoint(ClassLoaderResolver classLoaderResolver, File root, Iterable<? extends File> classPath) {
if (entryPoint == null || entryPoint.length() == 0) {
throw new GradleException("Entry point name is not defined");
}
for (EntryPoint.Default entryPoint : EntryPoint.Default.values()) {
if (this.entryPoint.equals(entryPoint.name())) {
return entryPoint;
}
}
try {
return (EntryPoint) Class.forName(entryPoint, false, classLoaderResolver.resolve(getClassPath(root, classPath)))
.getDeclaredConstructor()
.newInstance();
} catch (Exception exception) {
throw new GradleException("Cannot create entry point: " + entryPoint, exception);
}
} | [
"public",
"EntryPoint",
"getEntryPoint",
"(",
"ClassLoaderResolver",
"classLoaderResolver",
",",
"File",
"root",
",",
"Iterable",
"<",
"?",
"extends",
"File",
">",
"classPath",
")",
"{",
"if",
"(",
"entryPoint",
"==",
"null",
"||",
"entryPoint",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"GradleException",
"(",
"\"Entry point name is not defined\"",
")",
";",
"}",
"for",
"(",
"EntryPoint",
".",
"Default",
"entryPoint",
":",
"EntryPoint",
".",
"Default",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"entryPoint",
".",
"equals",
"(",
"entryPoint",
".",
"name",
"(",
")",
")",
")",
"{",
"return",
"entryPoint",
";",
"}",
"}",
"try",
"{",
"return",
"(",
"EntryPoint",
")",
"Class",
".",
"forName",
"(",
"entryPoint",
",",
"false",
",",
"classLoaderResolver",
".",
"resolve",
"(",
"getClassPath",
"(",
"root",
",",
"classPath",
")",
")",
")",
".",
"getDeclaredConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"throw",
"new",
"GradleException",
"(",
"\"Cannot create entry point: \"",
"+",
"entryPoint",
",",
"exception",
")",
";",
"}",
"}"
] | Resolves this initialization to an entry point instance.
@param classLoaderResolver The class loader resolver to use if appropriate.
@param root The root file describing the current tasks classes.
@param classPath The class path of the current task.
@return A resolved entry point. | [
"Resolves",
"this",
"initialization",
"to",
"an",
"entry",
"point",
"instance",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/Initialization.java#L61-L77 |
22,779 | raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyExtension.java | ByteBuddyExtension.transformation | public void transformation(Closure<?> closure) {
transformations.add((Transformation) project.configure(new Transformation(project), closure));
} | java | public void transformation(Closure<?> closure) {
transformations.add((Transformation) project.configure(new Transformation(project), closure));
} | [
"public",
"void",
"transformation",
"(",
"Closure",
"<",
"?",
">",
"closure",
")",
"{",
"transformations",
".",
"add",
"(",
"(",
"Transformation",
")",
"project",
".",
"configure",
"(",
"new",
"Transformation",
"(",
"project",
")",
",",
"closure",
")",
")",
";",
"}"
] | Adds a transformation to apply.
@param closure The closure for configuring the transformation. | [
"Adds",
"a",
"transformation",
"to",
"apply",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyExtension.java#L90-L92 |
22,780 | raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyExtension.java | ByteBuddyExtension.initialization | public void initialization(Closure<?> closure) {
if (initialization != null) {
throw new GradleException("Initialization is already set");
}
initialization = (Initialization) project.configure(new Initialization(), closure);
} | java | public void initialization(Closure<?> closure) {
if (initialization != null) {
throw new GradleException("Initialization is already set");
}
initialization = (Initialization) project.configure(new Initialization(), closure);
} | [
"public",
"void",
"initialization",
"(",
"Closure",
"<",
"?",
">",
"closure",
")",
"{",
"if",
"(",
"initialization",
"!=",
"null",
")",
"{",
"throw",
"new",
"GradleException",
"(",
"\"Initialization is already set\"",
")",
";",
"}",
"initialization",
"=",
"(",
"Initialization",
")",
"project",
".",
"configure",
"(",
"new",
"Initialization",
"(",
")",
",",
"closure",
")",
";",
"}"
] | Adds an initialization to apply.
@param closure The closure for configuring the initialization. | [
"Adds",
"an",
"initialization",
"to",
"apply",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyExtension.java#L99-L104 |
22,781 | raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyExtension.java | ByteBuddyExtension.getMethodNameTransformer | public MethodNameTransformer getMethodNameTransformer() {
return suffix == null || suffix.length() == 0
? MethodNameTransformer.Suffixing.withRandomSuffix()
: new MethodNameTransformer.Suffixing(suffix);
} | java | public MethodNameTransformer getMethodNameTransformer() {
return suffix == null || suffix.length() == 0
? MethodNameTransformer.Suffixing.withRandomSuffix()
: new MethodNameTransformer.Suffixing(suffix);
} | [
"public",
"MethodNameTransformer",
"getMethodNameTransformer",
"(",
")",
"{",
"return",
"suffix",
"==",
"null",
"||",
"suffix",
".",
"length",
"(",
")",
"==",
"0",
"?",
"MethodNameTransformer",
".",
"Suffixing",
".",
"withRandomSuffix",
"(",
")",
":",
"new",
"MethodNameTransformer",
".",
"Suffixing",
"(",
"suffix",
")",
";",
"}"
] | Returns the method name transformer to use.
@return The method name transformer to use. | [
"Returns",
"the",
"method",
"name",
"transformer",
"to",
"use",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/ByteBuddyExtension.java#L131-L135 |
22,782 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java | ClassByImplementationBenchmark.setup | @Setup
public void setup() {
baseClassDescription = TypePool.Default.ofSystemLoader().describe(baseClass.getName()).resolve();
} | java | @Setup
public void setup() {
baseClassDescription = TypePool.Default.ofSystemLoader().describe(baseClass.getName()).resolve();
} | [
"@",
"Setup",
"public",
"void",
"setup",
"(",
")",
"{",
"baseClassDescription",
"=",
"TypePool",
".",
"Default",
".",
"ofSystemLoader",
"(",
")",
".",
"describe",
"(",
"baseClass",
".",
"getName",
"(",
")",
")",
".",
"resolve",
"(",
")",
";",
"}"
] | Sets up this benchmark. | [
"Sets",
"up",
"this",
"benchmark",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L186-L189 |
22,783 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java | ClassByImplementationBenchmark.baseline | @Benchmark
public ExampleInterface baseline() {
return new ExampleInterface() {
public boolean method(boolean arg) {
return false;
}
public byte method(byte arg) {
return 0;
}
public short method(short arg) {
return 0;
}
public int method(int arg) {
return 0;
}
public char method(char arg) {
return 0;
}
public long method(long arg) {
return 0;
}
public float method(float arg) {
return 0;
}
public double method(double arg) {
return 0;
}
public Object method(Object arg) {
return null;
}
public boolean[] method(boolean arg1, boolean arg2, boolean arg3) {
return null;
}
public byte[] method(byte arg1, byte arg2, byte arg3) {
return null;
}
public short[] method(short arg1, short arg2, short arg3) {
return null;
}
public int[] method(int arg1, int arg2, int arg3) {
return null;
}
public char[] method(char arg1, char arg2, char arg3) {
return null;
}
public long[] method(long arg1, long arg2, long arg3) {
return null;
}
public float[] method(float arg1, float arg2, float arg3) {
return null;
}
public double[] method(double arg1, double arg2, double arg3) {
return null;
}
public Object[] method(Object arg1, Object arg2, Object arg3) {
return null;
}
};
} | java | @Benchmark
public ExampleInterface baseline() {
return new ExampleInterface() {
public boolean method(boolean arg) {
return false;
}
public byte method(byte arg) {
return 0;
}
public short method(short arg) {
return 0;
}
public int method(int arg) {
return 0;
}
public char method(char arg) {
return 0;
}
public long method(long arg) {
return 0;
}
public float method(float arg) {
return 0;
}
public double method(double arg) {
return 0;
}
public Object method(Object arg) {
return null;
}
public boolean[] method(boolean arg1, boolean arg2, boolean arg3) {
return null;
}
public byte[] method(byte arg1, byte arg2, byte arg3) {
return null;
}
public short[] method(short arg1, short arg2, short arg3) {
return null;
}
public int[] method(int arg1, int arg2, int arg3) {
return null;
}
public char[] method(char arg1, char arg2, char arg3) {
return null;
}
public long[] method(long arg1, long arg2, long arg3) {
return null;
}
public float[] method(float arg1, float arg2, float arg3) {
return null;
}
public double[] method(double arg1, double arg2, double arg3) {
return null;
}
public Object[] method(Object arg1, Object arg2, Object arg3) {
return null;
}
};
} | [
"@",
"Benchmark",
"public",
"ExampleInterface",
"baseline",
"(",
")",
"{",
"return",
"new",
"ExampleInterface",
"(",
")",
"{",
"public",
"boolean",
"method",
"(",
"boolean",
"arg",
")",
"{",
"return",
"false",
";",
"}",
"public",
"byte",
"method",
"(",
"byte",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"short",
"method",
"(",
"short",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"int",
"method",
"(",
"int",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"char",
"method",
"(",
"char",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"long",
"method",
"(",
"long",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"float",
"method",
"(",
"float",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"double",
"method",
"(",
"double",
"arg",
")",
"{",
"return",
"0",
";",
"}",
"public",
"Object",
"method",
"(",
"Object",
"arg",
")",
"{",
"return",
"null",
";",
"}",
"public",
"boolean",
"[",
"]",
"method",
"(",
"boolean",
"arg1",
",",
"boolean",
"arg2",
",",
"boolean",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"byte",
"[",
"]",
"method",
"(",
"byte",
"arg1",
",",
"byte",
"arg2",
",",
"byte",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"short",
"[",
"]",
"method",
"(",
"short",
"arg1",
",",
"short",
"arg2",
",",
"short",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"int",
"[",
"]",
"method",
"(",
"int",
"arg1",
",",
"int",
"arg2",
",",
"int",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"char",
"[",
"]",
"method",
"(",
"char",
"arg1",
",",
"char",
"arg2",
",",
"char",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"long",
"[",
"]",
"method",
"(",
"long",
"arg1",
",",
"long",
"arg2",
",",
"long",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"float",
"[",
"]",
"method",
"(",
"float",
"arg1",
",",
"float",
"arg2",
",",
"float",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"double",
"[",
"]",
"method",
"(",
"double",
"arg1",
",",
"double",
"arg2",
",",
"double",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"public",
"Object",
"[",
"]",
"method",
"(",
"Object",
"arg1",
",",
"Object",
"arg2",
",",
"Object",
"arg3",
")",
"{",
"return",
"null",
";",
"}",
"}",
";",
"}"
] | Creates a baseline for the benchmark.
@return A simple object that is not transformed. | [
"Creates",
"a",
"baseline",
"for",
"the",
"benchmark",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L196-L271 |
22,784 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java | ClassByImplementationBenchmark.benchmarkByteBuddy | @Benchmark
public ExampleInterface benchmarkByteBuddy() throws Exception {
return new ByteBuddy()
.with(TypeValidation.DISABLED)
.ignore(none())
.subclass(baseClass)
.method(isDeclaredBy(baseClass)).intercept(StubMethod.INSTANCE)
.make()
.load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION)
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} | java | @Benchmark
public ExampleInterface benchmarkByteBuddy() throws Exception {
return new ByteBuddy()
.with(TypeValidation.DISABLED)
.ignore(none())
.subclass(baseClass)
.method(isDeclaredBy(baseClass)).intercept(StubMethod.INSTANCE)
.make()
.load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION)
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} | [
"@",
"Benchmark",
"public",
"ExampleInterface",
"benchmarkByteBuddy",
"(",
")",
"throws",
"Exception",
"{",
"return",
"new",
"ByteBuddy",
"(",
")",
".",
"with",
"(",
"TypeValidation",
".",
"DISABLED",
")",
".",
"ignore",
"(",
"none",
"(",
")",
")",
".",
"subclass",
"(",
"baseClass",
")",
".",
"method",
"(",
"isDeclaredBy",
"(",
"baseClass",
")",
")",
".",
"intercept",
"(",
"StubMethod",
".",
"INSTANCE",
")",
".",
"make",
"(",
")",
".",
"load",
"(",
"newClassLoader",
"(",
")",
",",
"ClassLoadingStrategy",
".",
"Default",
".",
"INJECTION",
")",
".",
"getLoaded",
"(",
")",
".",
"getDeclaredConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}"
] | Performs a benchmark of an interface implementation using Byte Buddy.
@return The created instance, in order to avoid JIT removal.
@throws java.lang.Exception If the reflective invocation causes an exception. | [
"Performs",
"a",
"benchmark",
"of",
"an",
"interface",
"implementation",
"using",
"Byte",
"Buddy",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L279-L291 |
22,785 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java | ClassByImplementationBenchmark.benchmarkCglib | @Benchmark
public ExampleInterface benchmarkCglib() {
Enhancer enhancer = new Enhancer();
enhancer.setUseCache(false);
enhancer.setClassLoader(newClassLoader());
enhancer.setSuperclass(baseClass);
CallbackHelper callbackHelper = new CallbackHelper(Object.class, new Class[]{baseClass}) {
protected Object getCallback(Method method) {
if (method.getDeclaringClass() == baseClass) {
return new FixedValue() {
public Object loadObject() {
return null;
}
};
} else {
return NoOp.INSTANCE;
}
}
};
enhancer.setCallbackFilter(callbackHelper);
enhancer.setCallbacks(callbackHelper.getCallbacks());
return (ExampleInterface) enhancer.create();
} | java | @Benchmark
public ExampleInterface benchmarkCglib() {
Enhancer enhancer = new Enhancer();
enhancer.setUseCache(false);
enhancer.setClassLoader(newClassLoader());
enhancer.setSuperclass(baseClass);
CallbackHelper callbackHelper = new CallbackHelper(Object.class, new Class[]{baseClass}) {
protected Object getCallback(Method method) {
if (method.getDeclaringClass() == baseClass) {
return new FixedValue() {
public Object loadObject() {
return null;
}
};
} else {
return NoOp.INSTANCE;
}
}
};
enhancer.setCallbackFilter(callbackHelper);
enhancer.setCallbacks(callbackHelper.getCallbacks());
return (ExampleInterface) enhancer.create();
} | [
"@",
"Benchmark",
"public",
"ExampleInterface",
"benchmarkCglib",
"(",
")",
"{",
"Enhancer",
"enhancer",
"=",
"new",
"Enhancer",
"(",
")",
";",
"enhancer",
".",
"setUseCache",
"(",
"false",
")",
";",
"enhancer",
".",
"setClassLoader",
"(",
"newClassLoader",
"(",
")",
")",
";",
"enhancer",
".",
"setSuperclass",
"(",
"baseClass",
")",
";",
"CallbackHelper",
"callbackHelper",
"=",
"new",
"CallbackHelper",
"(",
"Object",
".",
"class",
",",
"new",
"Class",
"[",
"]",
"{",
"baseClass",
"}",
")",
"{",
"protected",
"Object",
"getCallback",
"(",
"Method",
"method",
")",
"{",
"if",
"(",
"method",
".",
"getDeclaringClass",
"(",
")",
"==",
"baseClass",
")",
"{",
"return",
"new",
"FixedValue",
"(",
")",
"{",
"public",
"Object",
"loadObject",
"(",
")",
"{",
"return",
"null",
";",
"}",
"}",
";",
"}",
"else",
"{",
"return",
"NoOp",
".",
"INSTANCE",
";",
"}",
"}",
"}",
";",
"enhancer",
".",
"setCallbackFilter",
"(",
"callbackHelper",
")",
";",
"enhancer",
".",
"setCallbacks",
"(",
"callbackHelper",
".",
"getCallbacks",
"(",
")",
")",
";",
"return",
"(",
"ExampleInterface",
")",
"enhancer",
".",
"create",
"(",
")",
";",
"}"
] | Performs a benchmark of an interface implementation using cglib.
@return The created instance, in order to avoid JIT removal. | [
"Performs",
"a",
"benchmark",
"of",
"an",
"interface",
"implementation",
"using",
"cglib",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L319-L341 |
22,786 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java | ClassByImplementationBenchmark.benchmarkJavassist | @Benchmark
public ExampleInterface benchmarkJavassist() throws Exception {
ProxyFactory proxyFactory = new ProxyFactory() {
protected ClassLoader getClassLoader() {
return newClassLoader();
}
};
proxyFactory.setUseCache(false);
proxyFactory.setUseWriteReplace(false);
proxyFactory.setSuperclass(Object.class);
proxyFactory.setInterfaces(new Class<?>[]{baseClass});
proxyFactory.setFilter(new MethodFilter() {
public boolean isHandled(Method method) {
return true;
}
});
@SuppressWarnings("unchecked")
Object instance = proxyFactory.createClass().getDeclaredConstructor().newInstance();
((javassist.util.proxy.Proxy) instance).setHandler(new MethodHandler() {
public Object invoke(Object self,
Method thisMethod,
Method proceed,
Object[] args) throws Throwable {
Class<?> returnType = thisMethod.getReturnType();
if (returnType.isPrimitive()) {
if (returnType == boolean.class) {
return defaultBooleanValue;
} else if (returnType == byte.class) {
return defaultByteValue;
} else if (returnType == short.class) {
return defaultShortValue;
} else if (returnType == char.class) {
return defaultCharValue;
} else if (returnType == int.class) {
return defaultIntValue;
} else if (returnType == long.class) {
return defaultLongValue;
} else if (returnType == float.class) {
return defaultFloatValue;
} else {
return defaultDoubleValue;
}
} else {
return defaultReferenceValue;
}
}
});
return (ExampleInterface) instance;
} | java | @Benchmark
public ExampleInterface benchmarkJavassist() throws Exception {
ProxyFactory proxyFactory = new ProxyFactory() {
protected ClassLoader getClassLoader() {
return newClassLoader();
}
};
proxyFactory.setUseCache(false);
proxyFactory.setUseWriteReplace(false);
proxyFactory.setSuperclass(Object.class);
proxyFactory.setInterfaces(new Class<?>[]{baseClass});
proxyFactory.setFilter(new MethodFilter() {
public boolean isHandled(Method method) {
return true;
}
});
@SuppressWarnings("unchecked")
Object instance = proxyFactory.createClass().getDeclaredConstructor().newInstance();
((javassist.util.proxy.Proxy) instance).setHandler(new MethodHandler() {
public Object invoke(Object self,
Method thisMethod,
Method proceed,
Object[] args) throws Throwable {
Class<?> returnType = thisMethod.getReturnType();
if (returnType.isPrimitive()) {
if (returnType == boolean.class) {
return defaultBooleanValue;
} else if (returnType == byte.class) {
return defaultByteValue;
} else if (returnType == short.class) {
return defaultShortValue;
} else if (returnType == char.class) {
return defaultCharValue;
} else if (returnType == int.class) {
return defaultIntValue;
} else if (returnType == long.class) {
return defaultLongValue;
} else if (returnType == float.class) {
return defaultFloatValue;
} else {
return defaultDoubleValue;
}
} else {
return defaultReferenceValue;
}
}
});
return (ExampleInterface) instance;
} | [
"@",
"Benchmark",
"public",
"ExampleInterface",
"benchmarkJavassist",
"(",
")",
"throws",
"Exception",
"{",
"ProxyFactory",
"proxyFactory",
"=",
"new",
"ProxyFactory",
"(",
")",
"{",
"protected",
"ClassLoader",
"getClassLoader",
"(",
")",
"{",
"return",
"newClassLoader",
"(",
")",
";",
"}",
"}",
";",
"proxyFactory",
".",
"setUseCache",
"(",
"false",
")",
";",
"proxyFactory",
".",
"setUseWriteReplace",
"(",
"false",
")",
";",
"proxyFactory",
".",
"setSuperclass",
"(",
"Object",
".",
"class",
")",
";",
"proxyFactory",
".",
"setInterfaces",
"(",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"baseClass",
"}",
")",
";",
"proxyFactory",
".",
"setFilter",
"(",
"new",
"MethodFilter",
"(",
")",
"{",
"public",
"boolean",
"isHandled",
"(",
"Method",
"method",
")",
"{",
"return",
"true",
";",
"}",
"}",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Object",
"instance",
"=",
"proxyFactory",
".",
"createClass",
"(",
")",
".",
"getDeclaredConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"(",
"(",
"javassist",
".",
"util",
".",
"proxy",
".",
"Proxy",
")",
"instance",
")",
".",
"setHandler",
"(",
"new",
"MethodHandler",
"(",
")",
"{",
"public",
"Object",
"invoke",
"(",
"Object",
"self",
",",
"Method",
"thisMethod",
",",
"Method",
"proceed",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"Class",
"<",
"?",
">",
"returnType",
"=",
"thisMethod",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"returnType",
"==",
"boolean",
".",
"class",
")",
"{",
"return",
"defaultBooleanValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"byte",
".",
"class",
")",
"{",
"return",
"defaultByteValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"short",
".",
"class",
")",
"{",
"return",
"defaultShortValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"char",
".",
"class",
")",
"{",
"return",
"defaultCharValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"int",
".",
"class",
")",
"{",
"return",
"defaultIntValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"long",
".",
"class",
")",
"{",
"return",
"defaultLongValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"float",
".",
"class",
")",
"{",
"return",
"defaultFloatValue",
";",
"}",
"else",
"{",
"return",
"defaultDoubleValue",
";",
"}",
"}",
"else",
"{",
"return",
"defaultReferenceValue",
";",
"}",
"}",
"}",
")",
";",
"return",
"(",
"ExampleInterface",
")",
"instance",
";",
"}"
] | Performs a benchmark of an interface implementation using javassist proxies.
@return The created instance, in order to avoid JIT removal.
@throws java.lang.Exception If the reflective invocation causes an exception. | [
"Performs",
"a",
"benchmark",
"of",
"an",
"interface",
"implementation",
"using",
"javassist",
"proxies",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L349-L397 |
22,787 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java | ClassByImplementationBenchmark.benchmarkJdkProxy | @Benchmark
public ExampleInterface benchmarkJdkProxy() throws Exception {
return (ExampleInterface) Proxy.newProxyInstance(newClassLoader(),
new Class<?>[]{baseClass},
new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) {
Class<?> returnType = method.getReturnType();
if (returnType.isPrimitive()) {
if (returnType == boolean.class) {
return defaultBooleanValue;
} else if (returnType == byte.class) {
return defaultByteValue;
} else if (returnType == short.class) {
return defaultShortValue;
} else if (returnType == char.class) {
return defaultCharValue;
} else if (returnType == int.class) {
return defaultIntValue;
} else if (returnType == long.class) {
return defaultLongValue;
} else if (returnType == float.class) {
return defaultFloatValue;
} else {
return defaultDoubleValue;
}
} else {
return defaultReferenceValue;
}
}
}
);
} | java | @Benchmark
public ExampleInterface benchmarkJdkProxy() throws Exception {
return (ExampleInterface) Proxy.newProxyInstance(newClassLoader(),
new Class<?>[]{baseClass},
new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) {
Class<?> returnType = method.getReturnType();
if (returnType.isPrimitive()) {
if (returnType == boolean.class) {
return defaultBooleanValue;
} else if (returnType == byte.class) {
return defaultByteValue;
} else if (returnType == short.class) {
return defaultShortValue;
} else if (returnType == char.class) {
return defaultCharValue;
} else if (returnType == int.class) {
return defaultIntValue;
} else if (returnType == long.class) {
return defaultLongValue;
} else if (returnType == float.class) {
return defaultFloatValue;
} else {
return defaultDoubleValue;
}
} else {
return defaultReferenceValue;
}
}
}
);
} | [
"@",
"Benchmark",
"public",
"ExampleInterface",
"benchmarkJdkProxy",
"(",
")",
"throws",
"Exception",
"{",
"return",
"(",
"ExampleInterface",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"newClassLoader",
"(",
")",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"]",
"{",
"baseClass",
"}",
",",
"new",
"InvocationHandler",
"(",
")",
"{",
"public",
"Object",
"invoke",
"(",
"Object",
"proxy",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Class",
"<",
"?",
">",
"returnType",
"=",
"method",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"returnType",
"==",
"boolean",
".",
"class",
")",
"{",
"return",
"defaultBooleanValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"byte",
".",
"class",
")",
"{",
"return",
"defaultByteValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"short",
".",
"class",
")",
"{",
"return",
"defaultShortValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"char",
".",
"class",
")",
"{",
"return",
"defaultCharValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"int",
".",
"class",
")",
"{",
"return",
"defaultIntValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"long",
".",
"class",
")",
"{",
"return",
"defaultLongValue",
";",
"}",
"else",
"if",
"(",
"returnType",
"==",
"float",
".",
"class",
")",
"{",
"return",
"defaultFloatValue",
";",
"}",
"else",
"{",
"return",
"defaultDoubleValue",
";",
"}",
"}",
"else",
"{",
"return",
"defaultReferenceValue",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Performs a benchmark of an interface implementation using the Java Class Library's utilities.
@return The created instance, in order to avoid JIT removal.
@throws java.lang.Exception If the reflective invocation causes an exception. | [
"Performs",
"a",
"benchmark",
"of",
"an",
"interface",
"implementation",
"using",
"the",
"Java",
"Class",
"Library",
"s",
"utilities",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L405-L436 |
22,788 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/subclass/SubclassDynamicTypeBuilder.java | SubclassDynamicTypeBuilder.applyConstructorStrategy | private InstrumentedType applyConstructorStrategy(InstrumentedType instrumentedType) {
if (!instrumentedType.isInterface()) {
for (MethodDescription.Token token : constructorStrategy.extractConstructors(instrumentedType)) {
instrumentedType = instrumentedType.withMethod(token);
}
}
return instrumentedType;
} | java | private InstrumentedType applyConstructorStrategy(InstrumentedType instrumentedType) {
if (!instrumentedType.isInterface()) {
for (MethodDescription.Token token : constructorStrategy.extractConstructors(instrumentedType)) {
instrumentedType = instrumentedType.withMethod(token);
}
}
return instrumentedType;
} | [
"private",
"InstrumentedType",
"applyConstructorStrategy",
"(",
"InstrumentedType",
"instrumentedType",
")",
"{",
"if",
"(",
"!",
"instrumentedType",
".",
"isInterface",
"(",
")",
")",
"{",
"for",
"(",
"MethodDescription",
".",
"Token",
"token",
":",
"constructorStrategy",
".",
"extractConstructors",
"(",
"instrumentedType",
")",
")",
"{",
"instrumentedType",
"=",
"instrumentedType",
".",
"withMethod",
"(",
"token",
")",
";",
"}",
"}",
"return",
"instrumentedType",
";",
"}"
] | Applies this builder's constructor strategy to the given instrumented type.
@param instrumentedType The instrumented type to apply the constructor onto.
@return The instrumented type with the constructor strategy applied onto. | [
"Applies",
"this",
"builder",
"s",
"constructor",
"strategy",
"to",
"the",
"given",
"instrumented",
"type",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/subclass/SubclassDynamicTypeBuilder.java#L234-L241 |
22,789 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java | StackAwareMethodVisitor.adjustStack | private void adjustStack(int delta, int offset) {
if (delta > 2) {
throw new IllegalStateException("Cannot push multiple values onto the operand stack: " + delta);
} else if (delta > 0) {
int position = current.size();
// The operand stack can legally underflow while traversing dead code.
while (offset > 0 && position > 0) {
offset -= current.get(--position).getSize();
}
if (offset < 0) {
throw new IllegalStateException("Unexpected offset underflow: " + offset);
}
current.add(position, StackSize.of(delta));
} else if (offset != 0) {
throw new IllegalStateException("Cannot specify non-zero offset " + offset + " for non-incrementing value: " + delta);
} else {
while (delta < 0) {
// The operand stack can legally underflow while traversing dead code.
if (current.isEmpty()) {
return;
}
delta += current.remove(current.size() - 1).getSize();
}
if (delta == 1) {
current.add(StackSize.SINGLE);
} else if (delta != 0) {
throw new IllegalStateException("Unexpected remainder on the operand stack: " + delta);
}
}
} | java | private void adjustStack(int delta, int offset) {
if (delta > 2) {
throw new IllegalStateException("Cannot push multiple values onto the operand stack: " + delta);
} else if (delta > 0) {
int position = current.size();
// The operand stack can legally underflow while traversing dead code.
while (offset > 0 && position > 0) {
offset -= current.get(--position).getSize();
}
if (offset < 0) {
throw new IllegalStateException("Unexpected offset underflow: " + offset);
}
current.add(position, StackSize.of(delta));
} else if (offset != 0) {
throw new IllegalStateException("Cannot specify non-zero offset " + offset + " for non-incrementing value: " + delta);
} else {
while (delta < 0) {
// The operand stack can legally underflow while traversing dead code.
if (current.isEmpty()) {
return;
}
delta += current.remove(current.size() - 1).getSize();
}
if (delta == 1) {
current.add(StackSize.SINGLE);
} else if (delta != 0) {
throw new IllegalStateException("Unexpected remainder on the operand stack: " + delta);
}
}
} | [
"private",
"void",
"adjustStack",
"(",
"int",
"delta",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"delta",
">",
"2",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot push multiple values onto the operand stack: \"",
"+",
"delta",
")",
";",
"}",
"else",
"if",
"(",
"delta",
">",
"0",
")",
"{",
"int",
"position",
"=",
"current",
".",
"size",
"(",
")",
";",
"// The operand stack can legally underflow while traversing dead code.",
"while",
"(",
"offset",
">",
"0",
"&&",
"position",
">",
"0",
")",
"{",
"offset",
"-=",
"current",
".",
"get",
"(",
"--",
"position",
")",
".",
"getSize",
"(",
")",
";",
"}",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unexpected offset underflow: \"",
"+",
"offset",
")",
";",
"}",
"current",
".",
"add",
"(",
"position",
",",
"StackSize",
".",
"of",
"(",
"delta",
")",
")",
";",
"}",
"else",
"if",
"(",
"offset",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot specify non-zero offset \"",
"+",
"offset",
"+",
"\" for non-incrementing value: \"",
"+",
"delta",
")",
";",
"}",
"else",
"{",
"while",
"(",
"delta",
"<",
"0",
")",
"{",
"// The operand stack can legally underflow while traversing dead code.",
"if",
"(",
"current",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"delta",
"+=",
"current",
".",
"remove",
"(",
"current",
".",
"size",
"(",
")",
"-",
"1",
")",
".",
"getSize",
"(",
")",
";",
"}",
"if",
"(",
"delta",
"==",
"1",
")",
"{",
"current",
".",
"add",
"(",
"StackSize",
".",
"SINGLE",
")",
";",
"}",
"else",
"if",
"(",
"delta",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unexpected remainder on the operand stack: \"",
"+",
"delta",
")",
";",
"}",
"}",
"}"
] | Adjusts the current state of the operand stack.
@param delta The change of the current operation of the operand stack. Must not be larger than {@code 2}.
@param offset The offset of the value within the operand stack. Must be bigger then {@code 0} and smaller than
the current stack size. Only permitted if the supplied {@code delta} is positive. | [
"Adjusts",
"the",
"current",
"state",
"of",
"the",
"operand",
"stack",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java#L99-L128 |
22,790 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java | StackAwareMethodVisitor.drainStack | public int drainStack(int store, int load, StackSize size) {
int difference = current.get(current.size() - 1).getSize() - size.getSize();
if (current.size() == 1 && difference == 0) {
return 0;
} else {
super.visitVarInsn(store, freeIndex);
if (difference == 1) {
super.visitInsn(Opcodes.POP);
} else if (difference != 0) {
throw new IllegalStateException("Unexpected remainder on the operand stack: " + difference);
}
doDrain(current.subList(0, current.size() - 1));
super.visitVarInsn(load, freeIndex);
return freeIndex + size.getSize();
}
} | java | public int drainStack(int store, int load, StackSize size) {
int difference = current.get(current.size() - 1).getSize() - size.getSize();
if (current.size() == 1 && difference == 0) {
return 0;
} else {
super.visitVarInsn(store, freeIndex);
if (difference == 1) {
super.visitInsn(Opcodes.POP);
} else if (difference != 0) {
throw new IllegalStateException("Unexpected remainder on the operand stack: " + difference);
}
doDrain(current.subList(0, current.size() - 1));
super.visitVarInsn(load, freeIndex);
return freeIndex + size.getSize();
}
} | [
"public",
"int",
"drainStack",
"(",
"int",
"store",
",",
"int",
"load",
",",
"StackSize",
"size",
")",
"{",
"int",
"difference",
"=",
"current",
".",
"get",
"(",
"current",
".",
"size",
"(",
")",
"-",
"1",
")",
".",
"getSize",
"(",
")",
"-",
"size",
".",
"getSize",
"(",
")",
";",
"if",
"(",
"current",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"difference",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"super",
".",
"visitVarInsn",
"(",
"store",
",",
"freeIndex",
")",
";",
"if",
"(",
"difference",
"==",
"1",
")",
"{",
"super",
".",
"visitInsn",
"(",
"Opcodes",
".",
"POP",
")",
";",
"}",
"else",
"if",
"(",
"difference",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unexpected remainder on the operand stack: \"",
"+",
"difference",
")",
";",
"}",
"doDrain",
"(",
"current",
".",
"subList",
"(",
"0",
",",
"current",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
";",
"super",
".",
"visitVarInsn",
"(",
"load",
",",
"freeIndex",
")",
";",
"return",
"freeIndex",
"+",
"size",
".",
"getSize",
"(",
")",
";",
"}",
"}"
] | Drains the stack to only contain the top value. For this, the value on top of the stack is temporarily stored
in the local variable array until all values on the stack are popped off. Subsequently, the top value is pushed
back onto the operand stack.
@param store The opcode used for storing the top value.
@param load The opcode used for loading the top value.
@param size The size of the value on top of the operand stack.
@return The minimal size of the local variable array that is required to perform the operation. | [
"Drains",
"the",
"stack",
"to",
"only",
"contain",
"the",
"top",
"value",
".",
"For",
"this",
"the",
"value",
"on",
"top",
"of",
"the",
"stack",
"is",
"temporarily",
"stored",
"in",
"the",
"local",
"variable",
"array",
"until",
"all",
"values",
"on",
"the",
"stack",
"are",
"popped",
"off",
".",
"Subsequently",
"the",
"top",
"value",
"is",
"pushed",
"back",
"onto",
"the",
"operand",
"stack",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java#L147-L162 |
22,791 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java | StackAwareMethodVisitor.doDrain | private void doDrain(List<StackSize> stackSizes) {
ListIterator<StackSize> iterator = stackSizes.listIterator(stackSizes.size());
while (iterator.hasPrevious()) {
StackSize current = iterator.previous();
switch (current) {
case SINGLE:
super.visitInsn(Opcodes.POP);
break;
case DOUBLE:
super.visitInsn(Opcodes.POP2);
break;
default:
throw new IllegalStateException("Unexpected stack size: " + current);
}
}
} | java | private void doDrain(List<StackSize> stackSizes) {
ListIterator<StackSize> iterator = stackSizes.listIterator(stackSizes.size());
while (iterator.hasPrevious()) {
StackSize current = iterator.previous();
switch (current) {
case SINGLE:
super.visitInsn(Opcodes.POP);
break;
case DOUBLE:
super.visitInsn(Opcodes.POP2);
break;
default:
throw new IllegalStateException("Unexpected stack size: " + current);
}
}
} | [
"private",
"void",
"doDrain",
"(",
"List",
"<",
"StackSize",
">",
"stackSizes",
")",
"{",
"ListIterator",
"<",
"StackSize",
">",
"iterator",
"=",
"stackSizes",
".",
"listIterator",
"(",
"stackSizes",
".",
"size",
"(",
")",
")",
";",
"while",
"(",
"iterator",
".",
"hasPrevious",
"(",
")",
")",
"{",
"StackSize",
"current",
"=",
"iterator",
".",
"previous",
"(",
")",
";",
"switch",
"(",
"current",
")",
"{",
"case",
"SINGLE",
":",
"super",
".",
"visitInsn",
"(",
"Opcodes",
".",
"POP",
")",
";",
"break",
";",
"case",
"DOUBLE",
":",
"super",
".",
"visitInsn",
"(",
"Opcodes",
".",
"POP2",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unexpected stack size: \"",
"+",
"current",
")",
";",
"}",
"}",
"}"
] | Drains all supplied elements of the operand stack.
@param stackSizes The stack sizes of the elements to drain. | [
"Drains",
"all",
"supplied",
"elements",
"of",
"the",
"operand",
"stack",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java#L169-L184 |
22,792 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java | StackAwareMethodVisitor.register | public void register(Label label, List<StackSize> stackSizes) {
sizes.put(label, stackSizes);
} | java | public void register(Label label, List<StackSize> stackSizes) {
sizes.put(label, stackSizes);
} | [
"public",
"void",
"register",
"(",
"Label",
"label",
",",
"List",
"<",
"StackSize",
">",
"stackSizes",
")",
"{",
"sizes",
".",
"put",
"(",
"label",
",",
"stackSizes",
")",
";",
"}"
] | Explicitly registers a label to define a given stack state.
@param label The label to register a stack state for.
@param stackSizes The stack sizes to assume when reaching the supplied label. | [
"Explicitly",
"registers",
"a",
"label",
"to",
"define",
"a",
"given",
"stack",
"state",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java#L192-L194 |
22,793 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FixedValue.java | FixedValue.value | public static AssignerConfigurable value(TypeDescription fixedValue) {
return new ForPoolValue(ClassConstant.of(fixedValue), TypeDescription.CLASS);
} | java | public static AssignerConfigurable value(TypeDescription fixedValue) {
return new ForPoolValue(ClassConstant.of(fixedValue), TypeDescription.CLASS);
} | [
"public",
"static",
"AssignerConfigurable",
"value",
"(",
"TypeDescription",
"fixedValue",
")",
"{",
"return",
"new",
"ForPoolValue",
"(",
"ClassConstant",
".",
"of",
"(",
"fixedValue",
")",
",",
"TypeDescription",
".",
"CLASS",
")",
";",
"}"
] | Returns the given type in form of a loaded type. The value is loaded from the written class's constant pool.
@param fixedValue The type to return from the method.
@return An implementation for the given {@code value}. | [
"Returns",
"the",
"given",
"type",
"in",
"form",
"of",
"a",
"loaded",
"type",
".",
"The",
"value",
"is",
"loaded",
"from",
"the",
"written",
"class",
"s",
"constant",
"pool",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FixedValue.java#L154-L156 |
22,794 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FixedValue.java | FixedValue.apply | protected ByteCodeAppender.Size apply(MethodVisitor methodVisitor,
Context implementationContext,
MethodDescription instrumentedMethod,
TypeDescription.Generic fixedValueType,
StackManipulation valueLoadingInstruction) {
StackManipulation assignment = assigner.assign(fixedValueType, instrumentedMethod.getReturnType(), typing);
if (!assignment.isValid()) {
throw new IllegalArgumentException("Cannot return value of type " + fixedValueType + " for " + instrumentedMethod);
}
StackManipulation.Size stackSize = new StackManipulation.Compound(
valueLoadingInstruction,
assignment,
MethodReturn.of(instrumentedMethod.getReturnType())
).apply(methodVisitor, implementationContext);
return new ByteCodeAppender.Size(stackSize.getMaximalSize(), instrumentedMethod.getStackSize());
} | java | protected ByteCodeAppender.Size apply(MethodVisitor methodVisitor,
Context implementationContext,
MethodDescription instrumentedMethod,
TypeDescription.Generic fixedValueType,
StackManipulation valueLoadingInstruction) {
StackManipulation assignment = assigner.assign(fixedValueType, instrumentedMethod.getReturnType(), typing);
if (!assignment.isValid()) {
throw new IllegalArgumentException("Cannot return value of type " + fixedValueType + " for " + instrumentedMethod);
}
StackManipulation.Size stackSize = new StackManipulation.Compound(
valueLoadingInstruction,
assignment,
MethodReturn.of(instrumentedMethod.getReturnType())
).apply(methodVisitor, implementationContext);
return new ByteCodeAppender.Size(stackSize.getMaximalSize(), instrumentedMethod.getStackSize());
} | [
"protected",
"ByteCodeAppender",
".",
"Size",
"apply",
"(",
"MethodVisitor",
"methodVisitor",
",",
"Context",
"implementationContext",
",",
"MethodDescription",
"instrumentedMethod",
",",
"TypeDescription",
".",
"Generic",
"fixedValueType",
",",
"StackManipulation",
"valueLoadingInstruction",
")",
"{",
"StackManipulation",
"assignment",
"=",
"assigner",
".",
"assign",
"(",
"fixedValueType",
",",
"instrumentedMethod",
".",
"getReturnType",
"(",
")",
",",
"typing",
")",
";",
"if",
"(",
"!",
"assignment",
".",
"isValid",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot return value of type \"",
"+",
"fixedValueType",
"+",
"\" for \"",
"+",
"instrumentedMethod",
")",
";",
"}",
"StackManipulation",
".",
"Size",
"stackSize",
"=",
"new",
"StackManipulation",
".",
"Compound",
"(",
"valueLoadingInstruction",
",",
"assignment",
",",
"MethodReturn",
".",
"of",
"(",
"instrumentedMethod",
".",
"getReturnType",
"(",
")",
")",
")",
".",
"apply",
"(",
"methodVisitor",
",",
"implementationContext",
")",
";",
"return",
"new",
"ByteCodeAppender",
".",
"Size",
"(",
"stackSize",
".",
"getMaximalSize",
"(",
")",
",",
"instrumentedMethod",
".",
"getStackSize",
"(",
")",
")",
";",
"}"
] | Blueprint method that for applying the actual implementation.
@param methodVisitor The method visitor to which the implementation is applied to.
@param implementationContext The implementation context for the given implementation.
@param instrumentedMethod The instrumented method that is target of the implementation.
@param fixedValueType A description of the type of the fixed value that is loaded by the
{@code valueLoadingInstruction}.
@param valueLoadingInstruction A stack manipulation that represents the loading of the fixed value onto the
operand stack.
@return A representation of the stack and variable array sized that are required for this implementation. | [
"Blueprint",
"method",
"that",
"for",
"applying",
"the",
"actual",
"implementation",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/FixedValue.java#L220-L235 |
22,795 | raphw/byte-buddy | byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/Initialization.java | Initialization.getEntryPoint | @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Applies Maven exception wrapper")
public EntryPoint getEntryPoint(ClassLoaderResolver classLoaderResolver, String groupId, String artifactId, String version, String packaging) throws MojoExecutionException {
if (entryPoint == null || entryPoint.length() == 0) {
throw new MojoExecutionException("Entry point name is not defined");
}
for (EntryPoint.Default entryPoint : EntryPoint.Default.values()) {
if (this.entryPoint.equals(entryPoint.name())) {
return entryPoint;
}
}
try {
return (EntryPoint) Class.forName(entryPoint, false, classLoaderResolver.resolve(asCoordinate(groupId, artifactId, version, packaging)))
.getDeclaredConstructor()
.newInstance();
} catch (Exception exception) {
throw new MojoExecutionException("Cannot create entry point: " + entryPoint, exception);
}
} | java | @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Applies Maven exception wrapper")
public EntryPoint getEntryPoint(ClassLoaderResolver classLoaderResolver, String groupId, String artifactId, String version, String packaging) throws MojoExecutionException {
if (entryPoint == null || entryPoint.length() == 0) {
throw new MojoExecutionException("Entry point name is not defined");
}
for (EntryPoint.Default entryPoint : EntryPoint.Default.values()) {
if (this.entryPoint.equals(entryPoint.name())) {
return entryPoint;
}
}
try {
return (EntryPoint) Class.forName(entryPoint, false, classLoaderResolver.resolve(asCoordinate(groupId, artifactId, version, packaging)))
.getDeclaredConstructor()
.newInstance();
} catch (Exception exception) {
throw new MojoExecutionException("Cannot create entry point: " + entryPoint, exception);
}
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"REC_CATCH_EXCEPTION\"",
",",
"justification",
"=",
"\"Applies Maven exception wrapper\"",
")",
"public",
"EntryPoint",
"getEntryPoint",
"(",
"ClassLoaderResolver",
"classLoaderResolver",
",",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
",",
"String",
"packaging",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"entryPoint",
"==",
"null",
"||",
"entryPoint",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Entry point name is not defined\"",
")",
";",
"}",
"for",
"(",
"EntryPoint",
".",
"Default",
"entryPoint",
":",
"EntryPoint",
".",
"Default",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"entryPoint",
".",
"equals",
"(",
"entryPoint",
".",
"name",
"(",
")",
")",
")",
"{",
"return",
"entryPoint",
";",
"}",
"}",
"try",
"{",
"return",
"(",
"EntryPoint",
")",
"Class",
".",
"forName",
"(",
"entryPoint",
",",
"false",
",",
"classLoaderResolver",
".",
"resolve",
"(",
"asCoordinate",
"(",
"groupId",
",",
"artifactId",
",",
"version",
",",
"packaging",
")",
")",
")",
".",
"getDeclaredConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Cannot create entry point: \"",
"+",
"entryPoint",
",",
"exception",
")",
";",
"}",
"}"
] | Resolves the described entry point.
@param classLoaderResolver The class loader resolved to use.
@param groupId This project's group id.
@param artifactId This project's artifact id.
@param version This project's version id.
@param packaging This project's packaging
@return The resolved entry point.
@throws MojoExecutionException If the entry point cannot be created. | [
"Resolves",
"the",
"described",
"entry",
"point",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/Initialization.java#L55-L72 |
22,796 | raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/InjectionClassLoader.java | InjectionClassLoader.defineClass | public Class<?> defineClass(String name, byte[] binaryRepresentation) throws ClassNotFoundException {
return defineClasses(Collections.singletonMap(name, binaryRepresentation)).get(name);
} | java | public Class<?> defineClass(String name, byte[] binaryRepresentation) throws ClassNotFoundException {
return defineClasses(Collections.singletonMap(name, binaryRepresentation)).get(name);
} | [
"public",
"Class",
"<",
"?",
">",
"defineClass",
"(",
"String",
"name",
",",
"byte",
"[",
"]",
"binaryRepresentation",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"defineClasses",
"(",
"Collections",
".",
"singletonMap",
"(",
"name",
",",
"binaryRepresentation",
")",
")",
".",
"get",
"(",
"name",
")",
";",
"}"
] | Defines a new type to be loaded by this class loader.
@param name The name of the type.
@param binaryRepresentation The type's binary representation.
@return The defined class or a previously defined class.
@throws ClassNotFoundException If the class could not be loaded. | [
"Defines",
"a",
"new",
"type",
"to",
"be",
"loaded",
"by",
"this",
"class",
"loader",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/InjectionClassLoader.java#L68-L70 |
22,797 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java | ClassByExtensionBenchmark.setup | @Setup
public void setup() {
proxyInterceptor = MethodDelegation.to(ByteBuddyProxyInterceptor.class);
accessInterceptor = MethodDelegation.to(ByteBuddyAccessInterceptor.class);
prefixInterceptor = MethodDelegation.to(ByteBuddyPrefixInterceptor.class);
baseClassDescription = TypePool.Default.ofSystemLoader().describe(baseClass.getName()).resolve();
proxyClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyProxyInterceptor.class.getName()).resolve();
accessClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyAccessInterceptor.class.getName()).resolve();
prefixClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyPrefixInterceptor.class.getName()).resolve();
proxyInterceptorDescription = MethodDelegation.to(proxyClassDescription);
accessInterceptorDescription = MethodDelegation.to(accessClassDescription);
prefixInterceptorDescription = MethodDelegation.to(prefixClassDescription);
} | java | @Setup
public void setup() {
proxyInterceptor = MethodDelegation.to(ByteBuddyProxyInterceptor.class);
accessInterceptor = MethodDelegation.to(ByteBuddyAccessInterceptor.class);
prefixInterceptor = MethodDelegation.to(ByteBuddyPrefixInterceptor.class);
baseClassDescription = TypePool.Default.ofSystemLoader().describe(baseClass.getName()).resolve();
proxyClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyProxyInterceptor.class.getName()).resolve();
accessClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyAccessInterceptor.class.getName()).resolve();
prefixClassDescription = TypePool.Default.ofSystemLoader().describe(ByteBuddyPrefixInterceptor.class.getName()).resolve();
proxyInterceptorDescription = MethodDelegation.to(proxyClassDescription);
accessInterceptorDescription = MethodDelegation.to(accessClassDescription);
prefixInterceptorDescription = MethodDelegation.to(prefixClassDescription);
} | [
"@",
"Setup",
"public",
"void",
"setup",
"(",
")",
"{",
"proxyInterceptor",
"=",
"MethodDelegation",
".",
"to",
"(",
"ByteBuddyProxyInterceptor",
".",
"class",
")",
";",
"accessInterceptor",
"=",
"MethodDelegation",
".",
"to",
"(",
"ByteBuddyAccessInterceptor",
".",
"class",
")",
";",
"prefixInterceptor",
"=",
"MethodDelegation",
".",
"to",
"(",
"ByteBuddyPrefixInterceptor",
".",
"class",
")",
";",
"baseClassDescription",
"=",
"TypePool",
".",
"Default",
".",
"ofSystemLoader",
"(",
")",
".",
"describe",
"(",
"baseClass",
".",
"getName",
"(",
")",
")",
".",
"resolve",
"(",
")",
";",
"proxyClassDescription",
"=",
"TypePool",
".",
"Default",
".",
"ofSystemLoader",
"(",
")",
".",
"describe",
"(",
"ByteBuddyProxyInterceptor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"resolve",
"(",
")",
";",
"accessClassDescription",
"=",
"TypePool",
".",
"Default",
".",
"ofSystemLoader",
"(",
")",
".",
"describe",
"(",
"ByteBuddyAccessInterceptor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"resolve",
"(",
")",
";",
"prefixClassDescription",
"=",
"TypePool",
".",
"Default",
".",
"ofSystemLoader",
"(",
")",
".",
"describe",
"(",
"ByteBuddyPrefixInterceptor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"resolve",
"(",
")",
";",
"proxyInterceptorDescription",
"=",
"MethodDelegation",
".",
"to",
"(",
"proxyClassDescription",
")",
";",
"accessInterceptorDescription",
"=",
"MethodDelegation",
".",
"to",
"(",
"accessClassDescription",
")",
";",
"prefixInterceptorDescription",
"=",
"MethodDelegation",
".",
"to",
"(",
"prefixClassDescription",
")",
";",
"}"
] | A setup method to create precomputed delegator. | [
"A",
"setup",
"method",
"to",
"create",
"precomputed",
"delegator",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java#L139-L151 |
22,798 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java | ClassByExtensionBenchmark.benchmarkByteBuddyWithProxyAndReusedDelegator | @Benchmark
public ExampleClass benchmarkByteBuddyWithProxyAndReusedDelegator() throws Exception {
return new ByteBuddy()
.with(TypeValidation.DISABLED)
.ignore(none())
.subclass(baseClass)
.method(isDeclaredBy(baseClass)).intercept(proxyInterceptor)
.make()
.load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION)
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} | java | @Benchmark
public ExampleClass benchmarkByteBuddyWithProxyAndReusedDelegator() throws Exception {
return new ByteBuddy()
.with(TypeValidation.DISABLED)
.ignore(none())
.subclass(baseClass)
.method(isDeclaredBy(baseClass)).intercept(proxyInterceptor)
.make()
.load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION)
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} | [
"@",
"Benchmark",
"public",
"ExampleClass",
"benchmarkByteBuddyWithProxyAndReusedDelegator",
"(",
")",
"throws",
"Exception",
"{",
"return",
"new",
"ByteBuddy",
"(",
")",
".",
"with",
"(",
"TypeValidation",
".",
"DISABLED",
")",
".",
"ignore",
"(",
"none",
"(",
")",
")",
".",
"subclass",
"(",
"baseClass",
")",
".",
"method",
"(",
"isDeclaredBy",
"(",
"baseClass",
")",
")",
".",
"intercept",
"(",
"proxyInterceptor",
")",
".",
"make",
"(",
")",
".",
"load",
"(",
"newClassLoader",
"(",
")",
",",
"ClassLoadingStrategy",
".",
"Default",
".",
"INJECTION",
")",
".",
"getLoaded",
"(",
")",
".",
"getDeclaredConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}"
] | Performs a benchmark of a class extension using Byte Buddy. This benchmark also uses the annotation-based approach
but creates delegation methods which do not require the creation of additional classes. This benchmark reuses a
precomputed delegator.
@return The created instance, in order to avoid JIT removal.
@throws Exception If the invocation causes an exception. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"class",
"extension",
"using",
"Byte",
"Buddy",
".",
"This",
"benchmark",
"also",
"uses",
"the",
"annotation",
"-",
"based",
"approach",
"but",
"creates",
"delegation",
"methods",
"which",
"do",
"not",
"require",
"the",
"creation",
"of",
"additional",
"classes",
".",
"This",
"benchmark",
"reuses",
"a",
"precomputed",
"delegator",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java#L192-L204 |
22,799 | raphw/byte-buddy | byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java | ClassByExtensionBenchmark.benchmarkByteBuddyWithAccessorWithTypePool | @Benchmark
public ExampleClass benchmarkByteBuddyWithAccessorWithTypePool() throws Exception {
return (ExampleClass) new ByteBuddy()
.with(TypeValidation.DISABLED)
.ignore(none())
.subclass(baseClassDescription)
.method(isDeclaredBy(baseClassDescription)).intercept(MethodDelegation.to(accessClassDescription))
.make()
.load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION)
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} | java | @Benchmark
public ExampleClass benchmarkByteBuddyWithAccessorWithTypePool() throws Exception {
return (ExampleClass) new ByteBuddy()
.with(TypeValidation.DISABLED)
.ignore(none())
.subclass(baseClassDescription)
.method(isDeclaredBy(baseClassDescription)).intercept(MethodDelegation.to(accessClassDescription))
.make()
.load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION)
.getLoaded()
.getDeclaredConstructor()
.newInstance();
} | [
"@",
"Benchmark",
"public",
"ExampleClass",
"benchmarkByteBuddyWithAccessorWithTypePool",
"(",
")",
"throws",
"Exception",
"{",
"return",
"(",
"ExampleClass",
")",
"new",
"ByteBuddy",
"(",
")",
".",
"with",
"(",
"TypeValidation",
".",
"DISABLED",
")",
".",
"ignore",
"(",
"none",
"(",
")",
")",
".",
"subclass",
"(",
"baseClassDescription",
")",
".",
"method",
"(",
"isDeclaredBy",
"(",
"baseClassDescription",
")",
")",
".",
"intercept",
"(",
"MethodDelegation",
".",
"to",
"(",
"accessClassDescription",
")",
")",
".",
"make",
"(",
")",
".",
"load",
"(",
"newClassLoader",
"(",
")",
",",
"ClassLoadingStrategy",
".",
"Default",
".",
"INJECTION",
")",
".",
"getLoaded",
"(",
")",
".",
"getDeclaredConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"}"
] | Performs a benchmark of a class extension using Byte Buddy. This benchmark also uses the annotation-based approach
but creates delegation methods which do not require the creation of additional classes. This benchmark uses a type
pool to compare against usage of the reflection API.
@return The created instance, in order to avoid JIT removal.
@throws Exception If the invocation causes an exception. | [
"Performs",
"a",
"benchmark",
"of",
"a",
"class",
"extension",
"using",
"Byte",
"Buddy",
".",
"This",
"benchmark",
"also",
"uses",
"the",
"annotation",
"-",
"based",
"approach",
"but",
"creates",
"delegation",
"methods",
"which",
"do",
"not",
"require",
"the",
"creation",
"of",
"additional",
"classes",
".",
"This",
"benchmark",
"uses",
"a",
"type",
"pool",
"to",
"compare",
"against",
"usage",
"of",
"the",
"reflection",
"API",
"."
] | 4d2dac80efb6bed89367567260f6811c2f712d12 | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByExtensionBenchmark.java#L301-L313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.