ADDITIONAL SYSTEM INFORMATION :
Property settings:
file.encoding = UTF-8
file.separator = /
java.class.path =
java.class.version = 69.0
java.home = /home/ubuntu/jdk-25
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 25.0.2+10-LTS-69
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 25
java.vendor = Oracle Corporation
java.vendor.url = https://java.oracle.com/
java.vendor.url.bug = https://bugreport.java.com/bugreport/
java.version = 25.0.2
java.version.date = 2026-01-20
java.vm.compressedOopsMode = Zero based
java.vm.info = mixed mode, sharing
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 25
java.vm.vendor = Oracle Corporation
java.vm.version = 25.0.2+10-LTS-69
jdk.debug = release
line.separator = \n
native.encoding = UTF-8
os.arch = amd64
os.name = Linux
os.version = 5.15.0-164-generic
path.separator = :
stderr.encoding = UTF-8
stdin.encoding = UTF-8
stdout.encoding = UTF-8
sun.arch.data.model = 64
sun.boot.library.path = /home/ubuntu/jdk-25/lib
sun.cpu.endian = little
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = UTF-8
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
user.country = US
user.home = /home/ubuntu
user.language = en
user.name = ubuntu
java version "25.0.2" 2026-01-20 LTS
Java(TM) SE Runtime Environment (build 25.0.2+10-LTS-69)
Java HotSpot(TM) 64-Bit Server VM (build 25.0.2+10-LTS-69, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When using the javax.tools.JavaCompiler API together with JavacTask and a TaskListener, invoking JavacTask.analyze() from within the TaskListener.started(TaskEvent) callback causes the Java compiler (javac) to crash with a NullPointerException.
This occurs during the compilation phase and results in an internal compiler error rather than a user-facing diagnostic. The behavior is observed consistently on JDK 17, 21, and 25. On JDK 11, a similar failure occurs, but with a broken compiler diagnostic message instead.
This report is submitted following the compiler’s explicit request to file a bug after encountering an internal compiler error.
---------- BEGIN SOURCE ----------
import javax.tools.*;
import javax.tools.JavaFileObject.Kind;
import com.sun.source.util.*;
import java.net.URI;
import java.util.*;
public class Test {
public static void main(String[] args) throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
JavaFileObject emptyFile = new SimpleJavaFileObject(
URI.create("string:///A.java"), Kind.SOURCE) {
@Override public CharSequence getCharContent(boolean i) { return ""; }
};
JavacTask task = (JavacTask) compiler.getTask(
null, null, null, null, null, List.of(emptyFile));
task.addTaskListener(new TaskListener() {
@Override
public void started(TaskEvent e) {
try {
task.analyze();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
task.call();
}
}
---------- END SOURCE ----------
FREQUENCY :
ALWAYS
Property settings:
file.encoding = UTF-8
file.separator = /
java.class.path =
java.class.version = 69.0
java.home = /home/ubuntu/jdk-25
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 25.0.2+10-LTS-69
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 25
java.vendor = Oracle Corporation
java.vendor.url = https://java.oracle.com/
java.vendor.url.bug = https://bugreport.java.com/bugreport/
java.version = 25.0.2
java.version.date = 2026-01-20
java.vm.compressedOopsMode = Zero based
java.vm.info = mixed mode, sharing
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 25
java.vm.vendor = Oracle Corporation
java.vm.version = 25.0.2+10-LTS-69
jdk.debug = release
line.separator = \n
native.encoding = UTF-8
os.arch = amd64
os.name = Linux
os.version = 5.15.0-164-generic
path.separator = :
stderr.encoding = UTF-8
stdin.encoding = UTF-8
stdout.encoding = UTF-8
sun.arch.data.model = 64
sun.boot.library.path = /home/ubuntu/jdk-25/lib
sun.cpu.endian = little
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = UTF-8
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
user.country = US
user.home = /home/ubuntu
user.language = en
user.name = ubuntu
java version "25.0.2" 2026-01-20 LTS
Java(TM) SE Runtime Environment (build 25.0.2+10-LTS-69)
Java HotSpot(TM) 64-Bit Server VM (build 25.0.2+10-LTS-69, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When using the javax.tools.JavaCompiler API together with JavacTask and a TaskListener, invoking JavacTask.analyze() from within the TaskListener.started(TaskEvent) callback causes the Java compiler (javac) to crash with a NullPointerException.
This occurs during the compilation phase and results in an internal compiler error rather than a user-facing diagnostic. The behavior is observed consistently on JDK 17, 21, and 25. On JDK 11, a similar failure occurs, but with a broken compiler diagnostic message instead.
This report is submitted following the compiler’s explicit request to file a bug after encountering an internal compiler error.
---------- BEGIN SOURCE ----------
import javax.tools.*;
import javax.tools.JavaFileObject.Kind;
import com.sun.source.util.*;
import java.net.URI;
import java.util.*;
public class Test {
public static void main(String[] args) throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
JavaFileObject emptyFile = new SimpleJavaFileObject(
URI.create("string:///A.java"), Kind.SOURCE) {
@Override public CharSequence getCharContent(boolean i) { return ""; }
};
JavacTask task = (JavacTask) compiler.getTask(
null, null, null, null, null, List.of(emptyFile));
task.addTaskListener(new TaskListener() {
@Override
public void started(TaskEvent e) {
try {
task.analyze();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
task.call();
}
}
---------- END SOURCE ----------
FREQUENCY :
ALWAYS