/vibe:ghcopilot-instr-java-21-to-java-25-upgradefrom vibe
Guides upgrading Java projects from JDK 21 to JDK 25, covering pattern matching enhancements, Class-File API migration from ASM, and Markdown documentation comments.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
These instructions help GitHub Copilot assist developers in upgrading Java projects from JDK 21 to JDK 25, focusing on new language features, API changes, and best practices.
Primitive Types in Patterns, instanceof, and switch
When working with pattern matching:
// Old approach (Java 21)
switch (x.getStatus()) {
case 0 -> "okay";
case 1 -> "warning";
case 2 -> "error";
default -> "unknown status: " + x.getStatus();
}
// New approach (Java 25 Preview)
switch (x.getStatus()) {
case 0 -> "okay";
case 1 -> "warning";
case 2 -> "error";
case int i -> "unknown status: " + i;
}
--enable-preview flagswitch (x.getYearlyFlights()) {
case 0 -> ...;
case int i when i >= 100 -> issueGoldCard();
case int i -> ... // handle 1-99 range
}
Replacing ASM with Standard API
When detecting bytecode manipulation or class file processing:
java.lang.classfile package instead of org.objectweb.asm// Old ASM approach
ClassReader reader = new ClassReader(classBytes);
ClassWriter writer = new ClassWriter(reader, 0);
// ... ASM manipulation
// New Class-File API approach
ClassModel classModel = ClassFile.of().parse(classBytes);
byte[] newBytes = ClassFile.of().transform(classModel,
ClassTransform.transformingMethods(methodTransform));
JavaDoc Modernization
When working with JavaDoc comments:
/// for Markdown documentation comments// Old HTML JavaDoc
/**
* Returns the <b>absolute</b> value of an {@code int} value.
* <p>
* If the argument is not negative, return the argument.
* If the argument is negative, return the negation of the argument.
*
* @param a the argument whose absolute value is to be determined
* @return the absolute value of the argument
*/
// New Markdown JavaDoc
/// Returns the **absolute** value of an `int` value.
///
/// If the argument is not negative, return the argument.
/// If the argument is negative, return the negation of the argument.
///
/// @param a the argument whose absolute value is to be determined
/// @return the absolute value of the argument
Record Enhancement
When working with records:
with expressions for creating derived records// Instead of manual record copying
public record Person(String name, int age, String email) {
public Person withAge(int newAge) {
return new Person(name, newAge, email);
}
}
// Use derived record creation (Preview)
Person updated = person with { age = 30; };
Enhanced Stream Processing
When working with complex stream operations:
Stream.gather() for custom intermediate operationsjava.util.stream.Gatherers for built-in gatherers// Custom windowing operations
List<List<String>> windows = stream
.gather(Gatherers.windowSliding(3))
.toList();
// Custom filtering with state
List<Integer> filtered = numbers.stream()
.gather(Gatherers.fold(0, (state, element) -> {
// Custom stateful logic
return state + element > threshold ? element : null;
}))
.filter(Objects::nonNull)
.toList();
When detecting sun.misc.Unsafe usage:
// Deprecated: sun.misc.Unsafe memory access
Unsafe unsafe = Unsafe.getUnsafe();
unsafe.getInt(object, offset);
// Preferred: VarHandle API
VarHandle vh = MethodHandles.lookup()
.findVarHandle(MyClass.class, "fieldName", int.class);
int value = (int) vh.get(object);
// Or for off-heap: Foreign Function & Memory API
MemorySegment segment = MemorySegment.ofArray(new int[10]);
int value = segment.get(ValueLayout.JAVA_INT, offset);
When detecting JNI usage:
--enable-native-access flag for applications using JNImodule com.example.app {
requires jdk.unsupported; // for remaining JNI usage
}
When configuring garbage collection:
# Explicit non-generational mode (will show deprecation warning)
-XX:+UseZGC -XX:-ZGenerational
# Default generational mode
-XX:+UseZGC
When using G1GC:
When working with numerical computations:
--add-modules jdk.incubator.vectorimport jdk.incubator.vector.*;
// Traditional scalar computation
for (int i = 0; i < a.length; i++) {
c[i] = a[i] + b[i];
}
// Vectorized computation
var species = IntVector.SPECIES_PREFERRED;
for (int i = 0; i < a.length; i += species.length()) {
var va = IntVector.fromArray(species, a, i);
var vb = IntVector.fromArray(species, b, i);
var vc = va.add(vb);
vc.intoArray(c, i);
}
For projects using preview features:
--enable-preview to compiler arguments--enable-preview to runtime arguments<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>25</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
tasks.withType<JavaCompile> {
options.compilerArgs.add("--enable-preview")
}
tasks.withType<Test> {
jvmArgs("--enable-preview")
}
When reviewing code for Java 25 upgrade:
--enable-preview flag for preview features--enable-native-access configurationRemember to test thoroughly in staging environments before deploying Java 25 upgrades to production systems.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job