A Semi-Deep Dive into Kotlin Inline Classes

With Kotlin 1.3, a new experimental feature called “Inline Classes” is now available. This post is a somewhat deep dive into the nature of the implementation, how it works, where the edges are, and what limitations currently exist. Let’s take a look!

[Read More]
kotlin  java  jvm 

Contracts in Kotlin 1.3

Kotlin 1.3 is bringing a new experimental feature to the compiler to help with improving program correctness via the type-system: contracts.

Contracts are a tool that allow library code (both standard library and your libraries) hint to the compiler about the constraints that are ensured on types based on the use of functions in your program. Let’s see how this can be used in practice.

[Read More]

De-Structuring in Kotlin

Recently I wrote an article about de-structuring in TypeScript, and hinted that Kotlin has a similar feature, but in more of a “strongly typed” language style. Today I want to discuss that feature. To re-cap from the previous article, de-structuring is, at the core, a syntactic sugar to easily “lift” parameters out of an object or array and declare local all in one shot. With ECMAScript and TypeScript, this comes in two forms: positional (for arrays and iterables) and by name (for objects). [Read More]
kotlin  java 

Typescript for Java Developers: Index Types

A fairly recent addition to Typescript is index types and the keyof operator. For a Java developer this is an interesting thing to learn about, as Java doesn’t have this feature, specifically due to type system inflexibility. Academically speaking, an index type is a small facet of dependent type systems (where one type in use is dependent upon the value of another input). This is also, in effect, a way to get many of the benefits of a heterogenous map. [Read More]

Typescript for Java Developers: De-Structuring of Variables

ECMAScript is all about wrangling loosely typed variables. In a compiled and strongly typed language like Java, classes have a fixed shape (aka schema) and every object follows that pattern strictly. With ECMAScript, objects are more “ad-hoc” in that any single object be comprised of any combination of properties. Prototypes help with pre-defining that combination, but you can muck around with it all you want. Consequently, there is an opportunity for language features around lifting, shifting, filtering, and moving around properties from objects. [Read More]

Typescript for Java Developers: Variable Scoping

When learning a language built on another existing platform, like TypeScript (or, for that matter Kotlin), one of the challenges you face is understanding the underlying platform or language so that you can, in turn, understand how the higher-level language is applied to meet the restrictions and features of the lower-level language. Inevitably, no amount of documentation for a language built upon another language or platform is complete without some degree of knowledge of the underlying platform. [Read More]

What's the Deal with @JvmDefault?

Kotlin has an annotation called @JvmDefault which, like most of the “Jvm” prefixed annotations, exists to help massage the Kotlin compiler output to match Java classes in a certain way. This annotation was added in 1.2.40, and has now seen some experimental enhancements in 1.2.50, so it seems worth exploring what this is all about.

[Read More]
kotlin  java  jvm 

Diagnosing a 3.6L "Pentastar" Jeep JK Radiator Fan Issue (Code: P0480)

Recently, I was driving my 2015 Jeep Wrangler JK Unlimited through a parking lot on a 95 degree day, and after leaving a stop sign, a check engine light flashed on (later I would learn it was a P0480 Cooling Fan Relay 1 Control Circuit), and shortly thereafter my Jeep overheated. What followed was a multi-day Google searching and diagnostic session, which made me realize there is a lack of information as well as a lot of mis-information about the 3.6L “Pentastar” Jeep Wrangler model years, and how the radiator fan works.

This is my summary of what I learned about the cooling fans on these Jeeps, so hopefully more people can diagnose issues themselves.

[Read More]