Skip to content
loading...

Never Inline Hack Java

mspondee profile image Molossus Spondee twitter logo ・1 min read  

As of occasion you may need to ensure some Java code is never inlined when debugging performance problems.

The following hack works around this by abusing a special exception for the Throwable constructor.

static T dontinline(Supplier supplier) {
return (T) new Throwable() {
Object sneak = supplier.get();
}.sneak;
}

twitter logo DISCUSS
Discussion
markdown guide
Classic DEV Post from Jul 26 '19

🎩 JavaScript Enhanced Scss mixins! 🎩 concepts explained

In the next post we are going to explore CSS @apply to supercharge what we talk about here....

Molossus Spondee profile image
Poetry, Music, Coding