-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P3
-
None
-
Affects Version/s: 25.0.2
-
Component/s: tools
-
linux
ADDITIONAL SYSTEM INFORMATION :
Here is the stacktrace:
```
java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Type.hasTag(com.sun.tools.javac.code.TypeTag)" because "tree.restype.type" is null
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1050)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:960)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5664)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5550)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5302)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1346)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:968)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:84)
at jdk.compiler/com.sun.tools.javac.api.JavacTool.run(JavacTool.java:214)
```
A DESCRIPTION OF THE PROBLEM :
Hello,
We are using the JavacTool compiler included in the OpenJDK 25.0.2 to compile dynamically some classes, which works great.
We just recently hit the stacktrace below during an automated test (running under docker with maven eclipse temurin 25) on a runner that has multiple executors. So it seems to be a concurrency issue.
The test was run again under similar load and passed without problem.
Note that the compilation occurs on the startup (so no concurrency occurs in our code at this time).
Here is how we start the compiler:
``
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
ByteArrayOutputStream errStream = new ByteArrayOutputStream();
int result = compiler.run(null, outStream, errStream, args.toArray(new String[args.size()]));
``
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Actually we don't have any reproducer for this issue, it just hit us once.
FREQUENCY :
RARELY
Here is the stacktrace:
```
java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Type.hasTag(com.sun.tools.javac.code.TypeTag)" because "tree.restype.type" is null
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1050)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:960)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:677)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:751)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5664)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5550)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5302)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1346)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:968)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:84)
at jdk.compiler/com.sun.tools.javac.api.JavacTool.run(JavacTool.java:214)
```
A DESCRIPTION OF THE PROBLEM :
Hello,
We are using the JavacTool compiler included in the OpenJDK 25.0.2 to compile dynamically some classes, which works great.
We just recently hit the stacktrace below during an automated test (running under docker with maven eclipse temurin 25) on a runner that has multiple executors. So it seems to be a concurrency issue.
The test was run again under similar load and passed without problem.
Note that the compilation occurs on the startup (so no concurrency occurs in our code at this time).
Here is how we start the compiler:
``
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
ByteArrayOutputStream errStream = new ByteArrayOutputStream();
int result = compiler.run(null, outStream, errStream, args.toArray(new String[args.size()]));
``
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Actually we don't have any reproducer for this issue, it just hit us once.
FREQUENCY :
RARELY