Skip to content

Instantly share code, notes, and snippets.

@ SpringOne Platform 2019

Oliver Drotbohm odrotbohm

@ SpringOne Platform 2019
Block or report user

Report or block odrotbohm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
* Copyright 2020 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
View readme.adoc

Hibernate Enhancer problem on Java 11

Spring RESTBucks uses Hibernate’s bytecode enhancement to avoid runtime overhead in favor of a build time step. This works fine on JDK 8. However, if the project is built on JDK 11, starting it fails with:

Caused by: java.lang.IllegalAccessError: Update to non-static final field org.springsource.restbucks.payment.Payment.order attempted from a different method ($$_hibernate_write_order) than the initializer method <init>
	at org.springsource.restbucks.payment.Payment.$$_hibernate_write_order( ~[classes/:na]
odrotbohm / readme.adoc
Created Jul 1, 2019
Proposal – Leveraging hypermedia in Android clients
View readme.adoc

Hypermedia in Android clients


When it comes to JVM based clients of REST / HTTP APIs, Android is the most dominant platform. There are a variety of HTTP client libraries available for Android, but none of them have dedicated support to work with hypermedia elements (like links and forms) or late binding of data. Using those elements is crucial to avoid strong coupling between client and server. See this presentation (slides, recording for details.


View gist:098d4330e08635e491a48b507c8eb580
Wanted but not invoked:
-> at
However, there was exactly 1 interaction with this mock:
class Sample {
public this someMethod() {
return this;
class Subtype extends Sample {};

Keybase proof

I hereby claim:

  • I am odrotbohm on github.
  • I am odrotbohm ( on keybase.
  • I have a public key ASBAoaL1ovuekChAwlljeBmx1owaUCg5zwckYgcSGiGeAQo

To claim this, I am signing this object:

public class MockPostProcessor implements BeanPostProcessor {
* (non-Javadoc)
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
public class Sample {
public static void main(String[] args) {
Foo<? extends Bar<?>> foo = new Foo<>();
// Compiles
Iterable<?> first = foo.someMethod();
DedicatedWrapper<? extends Bar<?>> dedicatedWrapper = foo.someOtherMethod();
odrotbohm / using-annotation-based-null-checks-in-eclipse.adoc
Last active Jun 27, 2017
Using annotation based null checks in Eclipse
View using-annotation-based-null-checks-in-eclipse.adoc

Using annotation based null checks in Eclipse

Found issues

Calls to remote API not using nullability annotations cause warnings

Assume you call some external API (e.g. JDK API) that doesn’t use the nullability annotations:

odrotbohm /
Last active Mar 21, 2018
Lambda type detection sample
public class LambdaTypeDetectionSample {
public static void main(String[] args) {
Function<Integer, String> lambdaFunction = i -> i.toString();
Function<Integer, String> oldschoolFunction = new Function<Integer, String>() {
public String apply(Integer t) {
return t.toString();
You can’t perform that action at this time.