Skip to content

Commit

Permalink
Reproducer for raphw/byte-buddy#1732
Browse files Browse the repository at this point in the history
  • Loading branch information
Justinas Dabravolskas committed Dec 8, 2024
0 parents commit faffe67
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# jit-broken-switch-example
35 changes: 35 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.11.1/userguide/building_java_projects.html in the Gradle documentation.
*/

plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

dependencies {
implementation 'net.bytebuddy:byte-buddy:1.15.10'
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

application {
// Define the main class for the application.
mainClass = 'org.example.App'
applicationDefaultJvmArgs = [
'-Xcomp',
]
}
23 changes: 23 additions & 0 deletions app/src/main/java/org/example/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.example;
import com.sun.tools.attach.VirtualMachine;
import net.bytebuddy.dynamic.scaffold.TypeValidation;
import net.bytebuddy.*;
import net.bytebuddy.dynamic.*;
public class App {

private static final int POOL_NORMAL = 0;
private static final int POOL_SUSPENDED = 1;
private static final int POOL_SHUTDOWN = 2;

public volatile int poolState;

public static void main(String[] args) {
System.out.println("Running on:"+System.getProperty("java.version"));
DynamicType.Builder<App> builder = new ByteBuddy().with(TypeValidation.ENABLED)
.redefine(App.class)
.name(App.class.getName() + "_Redefine");
for (int i = 0; i < 100; i++) {
builder.make();
}
}
}
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

org.gradle.configuration-cache=true

0 comments on commit faffe67

Please sign in to comment.