File size: 4,691 Bytes
fdf294b
8533a11
fdf294b
 
 
8533a11
 
fdf294b
8533a11
4a10987
 
8533a11
9426e58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
881e4d4
9426e58
881e4d4
 
9426e58
 
 
 
 
fdf294b
 
8533a11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a10987
8533a11
fdf294b
4a10987
8533a11
 
fdf294b
8533a11
fdf294b
4a10987
8533a11
4a10987
 
8533a11
 
 
 
 
 
 
 
4a10987
8533a11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fdf294b
4a10987
8533a11
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
license: mit
task_categories:
- text-generation
tags:
- code
- java
- refactoring
- benchmark
- software-engineering
size_categories:
- n<1K
dataset_info:
  features:
  - name: instance_id
    dtype: string
  - name: repo
    dtype: string
  - name: resource_tier
    dtype: string
  - name: repo_stars
    dtype: float64
  - name: repo_forks
    dtype: float64
  - name: language
    dtype: string
  - name: base_commit
    dtype: string
  - name: merge_commit
    dtype: string
  - name: refactoring_types
    list: string
  - name: refactoring_descriptions
    list: string
  - name: file_path
    dtype: string
  - name: source_code_before
    dtype: string
  - name: source_code_after
    dtype: string
  - name: diff
    dtype: string
  - name: is_pure_refactoring
    dtype: bool
  - name: compile_before
    dtype: bool
  - name: compile_after
    dtype: bool
  - name: tests_pass_before
    dtype: bool
  - name: tests_pass_after
    dtype: bool
  - name: FAIL_TO_PASS
    list: string
  - name: PASS_TO_PASS
    list: string
  - name: created_at
    dtype: string
  - name: repo_license
    dtype: string
  - name: lines_changed
    dtype: float64
  splits:
  - name: test
    num_bytes: 279451236
    num_examples: 816
  download_size: 245967508
  dataset_size: 279451236
configs:
- config_name: default
  data_files:
  - split: test
    path: data/test-*
---

# CS4570 Java Refactoring Benchmark

A benchmark of Java refactoring commits mined from GitHub repositories, split into **high-resource** and **low-resource** tiers based on repository popularity. Built for the TU Delft CS4570 ML for Software Engineering course (2026).

## Dataset split

| Tier | Repositories | Instances | Star range |
|------|-------------|-----------|------------|
| High-resource | 57 | 618 | 1000-7298 |
| Low-resource | ~60 | 198 | 13-90 |
| **Total** | | **816** | |

Use the `resource_tier` field to filter by tier. `repo_stars` and `repo_forks` are included for fine-grained popularity analysis.

## Construction

Each instance is a single-file refactoring commit that was:

1. Detected by **RefactoringMiner 3.1.3** as containing at least one Java refactoring operation
2. Verified by building the project before and after the commit using Docker (Maven/Gradle, JDK 17/21)
3. Filtered to commits where the project compiles and tests pass both before and after (pure refactorings)

High-resource repos have >=1000 stars and >=10 contributors; low-resource repos have <100 stars.

## Fields

| Field | Type | Description |
|-------|------|-------------|
| `instance_id` | string | Unique identifier |
| `repo` | string | owner/repo identifier |
| `resource_tier` | string | "high" or "low" |
| `repo_stars` | int or null | GitHub star count at collection time |
| `repo_forks` | int or null | GitHub fork count at collection time |
| `language` | string | Always "java" |
| `base_commit` | string | Parent commit SHA |
| `merge_commit` | string | Refactoring commit SHA |
| `refactoring_types` | list[str] | Refactoring type labels from RefactoringMiner |
| `refactoring_descriptions` | list[str] or null | Human-readable descriptions (HR only) |
| `file_path` | string | Java file path that was refactored |
| `source_code_before` | string | File content at base commit |
| `source_code_after` | string | File content at merge commit |
| `diff` | string | Unified diff between before and after |
| `is_pure_refactoring` | bool or null | True if only refactoring operations changed |
| `compile_before` | bool or null | Project compiled at base commit |
| `compile_after` | bool or null | Project compiled at merge commit |
| `tests_pass_before` | bool or null | All tests pass at base commit |
| `tests_pass_after` | bool or null | All tests pass at merge commit |
| `FAIL_TO_PASS` | list[str] | Tests failing before, passing after |
| `PASS_TO_PASS` | list[str] | Tests passing both before and after |
| `created_at` | string or null | Commit timestamp (ISO 8601) |
| `repo_license` | string or null | SPDX license identifier |
| `lines_changed` | int or null | Lines changed in the refactoring |

## Refactoring types

Top types across both tiers: Extract Method, Rename Method, Rename Variable, Rename Parameter, Extract Variable, Inline Variable, Change Variable Type, Add Parameter, Add Method Annotation, Rename Attribute.

66 unique refactoring types in total.

## Usage

```python
from datasets import load_dataset

ds = load_dataset("Maxros/test", split="test")

# Filter by tier
hr = ds.filter(lambda x: x["resource_tier"] == "high")
lr = ds.filter(lambda x: x["resource_tier"] == "low")
```

## Citation

```
TU Delft CS4570 -- ML for Software Engineering benchmark, 2026.
```