4 minute read Published:

Value Types or: Letā€™s add another type system to Java

Java has two major type systems, primitives types(eg. int, byte, etc) and class/object types(eg. java.lang.String). Primitive types provide concise storage of data with no attach methods, while class types provide the ability to extend the functionality of an object while sacrificing space. These type systems are on different ends of the space/performance spectrum and Value Types aim to get the best of both worlds. Value Types are a JDK Enhancement Proposals(JEP) that will add a change to the JVM instruction set allowing “support [for] small immutable, identityless value types”.

1 minute read Published:

Introducing gradle-syntastic-plugin 0.3.6

I’m excited about this release of gradle-syntastic-plugin becauase it make integrating syntastic with your Gradle projects simple. The secret is getting it to work with the Gradle PluginsĀ mechanism. Now the only thing required to setup a project is to add the following to yourĀ plugin DSL. id 'com.scuilion.syntastic' version '0.3.6' Here is an example of what a simple Java project would look like in Gradle. plugins { id 'org.gradle.java' id 'com.

4 minute read Published:

Handling Permissions in REST

Figuring out how to handle permission when designing a REST API can get confusing. Especially if you don"t have names to describe your permissions. I hadĀ gone through most of the permission use cases and was trying to convey the requirements to our contractors. This is when I found a great doc on authorization for Apache Shiro. It gives names to the different levels of permissions. Giving good names to the concepts I was trying to convey solidified the ideas in my head (and on paper).

4 minute read Published:

Refactoring : Logical Operators Instead of Conditional Flow

I’ve recently been reading Working Effectively With Legacy Code by Feathers (an oldie, but a goodies). The book is good resource of techniques of refactoring but more importantly, it is a reminder to be more observant when looking through old code, and that is exactly what happened to me this weekend. I was trying to familiarize myself with how our application used OSGi inside of a web container when I came acrossĀ the following code.

4 minute read Published:

Annotation Processing in Java

Java 8 introduced Type Annotations. This means you can do something like the following: public void processChange(@NonNull Boolean set){} Java points out that it doesn’t supply a type checking framework but this got me to thinking. How can we as a company use annotations to make better internal code? Of course we all use annotations on a regular basis but how can we indicate to our coworkers our intentions and reduce bugs.

3 minute read Published:

Weld CDI: User Injected Functionality

Here is the scenario: Suppose you are creating a library that will aggregate data from a system and sendĀ that information to standardĀ out. A user may want to use your library to aggregate the same information but wants to send the data elsewhere (eg, a db, a file, etc). How do you provide these feature to you library without the user having to explicitly create your object and pass in a writer?

3 minute read Published:

Using Gradle Setup Info Outside of Gradle

There is a Dev/Ops at my company that is always trying to be clever. His ultimate goal is reduce build times, so I can’t get upset. Recently, he was trying to figure out what project were building and where they were located. He generated this list by making some assumptions about how our Gradle build was determining subprojects and created a script to generate a list of those locations. The problem with that is, if the scheme for subproject generation changed he would have to manually maintain his script.

3 minute read Published:

Debugging Vim Plugins With strace or: Remembering the Past

Background Syntastic has several ways for you to define your classpath when using javac. The way that I’ve chosen to manage my workspaces is by using the dot config file (.syntastic_javac_config). Syntastic will look for a global Vim variable, g:syntastic_java_javac_classpath, in the config file located in the pwd . I’d previously gotten syntastic to compile correctly using my config file but when I moved to another computer it inexplicably stopped. Learning how to write or debug Vim plugins is not on the top of my to-do list.

1 minute read Published:

Gradle ā€“ Create a New File From Text

This feels like a feature that should be baked into Gradle or at least common, but nothing comes up when I search how to create a file on the fly. The requirements: Create a file where one does not exist from generated text Make it incremental The following is my solution: project.task('createFile') { inputs.property "myTextProperty", "any old text" outputs.file outputFile doLast{ outputFile.write "some text" outputFile.write inputs.properties.myTextProperty } } Using the inputs and outputs makes the task incremental and the doLast is required if you don’t want the file to be created during theĀ configuration phase.

3 minute read Published:

First Experience with Bintray

When I started to learn Gradle, I wrote a simple plugin. It was a fairly useless adapter for JavaExec. It automatically set up the classpath and created an extension for pointing to the main class. This was a exercise. project.extensions.create("runSimple", RunSimpleExtension) project.task('runSimple', type: JavaExec ) { project.afterEvaluate{ main = project.runSimple.mainClass classpath = project.sourceSets.main.runtimeClasspath } } Recently, I’ve been beefing up my development process in Vim and installed Syntastic. This plugin provides syntax checking by running external checkers, two of which I needed-JSHint and javac.