Skip to content

Instantly share code, notes, and snippets.

View raphw's full-sized avatar

Rafael Winterhalter raphw

View GitHub Profile
@raphw
raphw / GenericVisibilityBridge.java
Last active August 29, 2015 14:26
Visibility bridges
package pkg;
class GenericVisibilityBridge extends GenericVisibilityBridgeBase<Void> {
@Override
public void foo(Void aVoid) {
System.out.println("specialized");
}
}
@raphw
raphw / Foo.java
Created August 3, 2015 08:30
FinalVisibilityBridge
package foo;
public class Foo extends Base {
}
class Base {
public final void foo() {
@raphw
raphw / Example.java
Last active August 29, 2015 14:26
Example for VerifierError when using method reference within a lambda before constructor is completed.
class Example {
Example(Function<Function<Function<Consumer<Void>, Void>, Void>, Void> innerClass) {
new InnerClass(innerClass);
}
void foo(Void v) { }
class InnerClass {
@raphw
raphw / SealedQuirk.java
Last active August 29, 2015 14:27
Sealed package quirk.
public class SealedQuirk {
private static final String FOO = "foo", BAR = "bar", TMP = "tmp";
private ClassLoader singleClassLoader, sealedChildClassLoader, sealedParentClassLoader;
@Before
public void setUp() throws Exception {
File folder = Files.createTempDirectory(TMP).toFile();
@raphw
raphw / Bar.java
Last active September 2, 2015 08:55
Package-private types in bridges.
package net.bytebuddy.bar;
public class Bar<T extends Baz> {
public void foo(T t) { }
}
@raphw
raphw / Interceptor.java
Created October 11, 2015 10:12
Example for bug report
package net.bytebuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.Origin;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.matcher.ElementMatchers;
@raphw
raphw / bower.json
Created November 26, 2015 14:01
Simple Gulp script
{
"name": "app",
"version": "0.0.0",
"authors": [
"foo <[email protected]>"
],
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
@raphw
raphw / Foo.java
Last active January 11, 2016 23:42
Example of wrong type annotation indexing of type varaible bounds on recursive type variables by Java Core reflection
package net.bytebuddy.description;
import jdk.internal.org.objectweb.asm.TypeReference;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.List;
@raphw
raphw / Foo.java
Last active January 12, 2016 00:08
Impossible to read owner type of an annotated parameterized type.
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.AnnotatedParameterizedType;
public class Foo<T> {
@Sample(1) Foo<@Sample(2) Void>.@Sample(3) Bar<@Sample(4) Void> field;
@raphw
raphw / Foo.java
Created January 12, 2016 00:24
Type annotations on parameters of multiple type variable bound types are not filtered to their respective bound.
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.AnnotatedParameterizedType;
import java.util.List;
import java.util.concurrent.Callable;
public class Foo<T extends List<@Sample ?> & Callable<@Sample ?>> {