apache / apache/maven-compiler-plugin

[MCOMPILER-345] Incorrect incremental test compilation

Open
#562 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
261
Forks
191
Avg merge
1d 5h
Merged PRs (30d)
8

Description

**[Chenguang Zhu](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=cgzhu)** opened **[MCOMPILER-345](https://issues.apache.org/jira/browse/MCOMPILER-345?redirect=false)** and commented

Summary: Consder the following simple project. There are three
classes, A, C (which extends A), and T (which is a test class). Class
A has method m(int), class C has method m(long), and test invokes m
with int value. If we run 'mvn test' the test passes. If we then
remove "extends A" from C and run 'mvn test' again, the run fails with
'NoSuchMethodError'. We noticed in the output that the test class was
not recompiled (which should likely have been done).

Steps to Reproduce: Run the bash script ./s provided in this
directory. The script (1) runs mvn test, (2) removes 'extends A' from
class C, and (3) runs mvn test again.

Expected Results: p.CTest fails in the second execution. Failed tests:
test(p.CTest): expected:<0> but was:<1>.

Actual Results: p.CTest has an error in the second execution.
java.lang.NoSuchMethodError: p.C.m(I)I.

---

**Affects:** 3.7.0

**Attachments:**
- [maven_bug_incremental_compile.zip](https://issues.apache.org/jira/secure/attachment/12907623/maven_bug_incremental_compile.zip) (_3.90 kB_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by unpacking maven_bug_incremental_compile.zip and running the provided ./s script, which executes mvn test twice after removing "extends A" from C. Trace how the Maven Compiler Plugin decides whether p.CTest needs recompilation; done means the second run recompiles the test and reports the expected assertion failure instead of NoSuchMethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.