Java
JEP 457 Hello World Translator
If you're new to Java class files and Java bytecode check out JEP 457 Hello World which is an introduction to the topic.
Often, when you start to learn a new language you'll write a "Hello World" application as a first step. In this post, as a first step to transforming Java class files, we'll write a "Hello World" translator.
We'll see how, in just a few lines of code using the JEP 457 Java Class-File API, we can create an application that can apply a code transformation to automatically translate "Hello World" to some other language such as "Hallo Wereld".
Build A Compiler With The JEP 457 Class-File API
This is an updated version of the Java Advent 2023 article "My First Compiler" using the JEP 457 Class-File API instead of ProGuardCORE for class file generation.
As a Java developer you probably spend a lot of time writing Java source code and executing a Java compiler to convert that human readable Java source into machine readable bytecode stored in Java class files.
If you've ever wondered how a compiler works or how a Java compiler creates Java class files, then keep reading! We'll work through writing a compiler for a simple programming language that compiles to Java bytecode.
We'll implement a compiler for the esoteric programming language Brainf*ck, which is simple enough that it doesn’t require much code to create a working compiler.
JEP 457 Hello World
This is an updated version of the Java Advent 2022 "JVM Hello World" using the JEP 457 Class-File API.
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
If you’re a Java developer, you might even remember the first time you typed public static void main(String[] args) in your editor of choice. But did you ever wonder what’s inside that “.class” file that the compiler spits out? Let’s look at how we can write a JVM “Hello World” by creating a class file programmatically.
We’ll work through creating a class file for the following simple Java Hello World application.
JVM Hello World
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
If you’re a Java developer, you might even remember the first time you typed public static void main(String[] args) in your editor of choice. But did you ever wonder what’s inside that “.class” file that the compiler spits out? Let’s look at how we can write a JVM “Hello World” by creating a class file programmatically.
We’ll work through creating a class file for the following simple Java Hello World application.
How To Build A Log4Shell Detector
Log4Shell (CVE-2021-44228) is a zero-day vulnerability in Log4J, a popular open-source Java logging framework used by many organizations around the world. Though the vulnerability has been patched, and upgrading to a newer Log4J version solves the problem, not everyone has completed the necessary upgrade.
I've written a Guardsquare blog post showing how you can be build a Log4Shell detector using ProGuardCORE to determine if applications are using an older Log4J version that is susceptible to the vulnerability.
Advent of Code 2017
I used Advent of Code 2017 to try out a few different languages: Java, Lisp, Scala or Python.
Static Source Code Analysis Tools and their Application to the Detection of Plagiarism in Java Programs
This project develops a system for detecting plagiarism in sets of student assignments written in Java. Plagiarism is viewed as a form of code obfuscation where students deliberately perform semantics preserving transformations of an original working version to pass it of as their own. In order to detect such obfuscations we assume we have a set of programs in which we attempt to find transformations that have been applied. We investigate tools for static analysis and transformation of Java programs to build a system for plagiarism detection.
Artificial Ants: Simulating Ant Behaviour and Investigating Applications In Computing
Ants are excellent route finders, with the ability to find the shortest path between their nest and a food source, by using pheromone trail clues to organize themselves collectively. By applying behaviour observed in ant colonies to the field of computing, these ant-based techniques can provide a base for network routing algorithms, as well as algorithms to solve graph problems such as the travelling salesman problem.