apache / apache/netbeans

Investigate com.sun.tools.classfile usage

Open
#9,368 1 comment 0 reactions 1 assignee Claimed by @jtulach View on GitHub
Code cleanup Java nb-javac
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

JDK 25+ doesn't have the `com.sun.tools.classfile` package anymore (since it got replaced by the public [classfile-api](https://openjdk.org/jeps/484)), compare:
- https://github.com/search?q=repo%3Aopenjdk%2Fjdk24u+com.sun.tools.classfile&type=code
- https://github.com/search?q=repo%3Aopenjdk%2Fjdk25u+com.sun.tools.classfile&type=code

symptom: Noticed this while observing startup warnings:
```
WARNING: package com.sun.tools.classfile not in jdk.jdeps
```

so, why does it not explode at runtime? nb-javac ships it. Where does it get it from when it is lo longer in the JDK? It is copied from nb-javac 21 (!) producing a frankenstein javac:

https://github.com/JaroslavTulach/nb-javac/blob/50889546cfec421fbfc85158332cede5522d3af2/make/langtools/netbeans/nb-javac/build.xml#L202-L208

https://github.com/JaroslavTulach/nb-javac/blob/50889546cfec421fbfc85158332cede5522d3af2/make/langtools/netbeans/nb-javac/build.xml#L313

https://github.com/JaroslavTulach/nb-javac/commit/2781c00716f60f2510d29f76e236fb62b19f07eb

NB usage is only via [classfile/CodeGenerator](https://github.com/apache/netbeans/blob/master/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java) and some Strings:
https://github.com/search?q=repo%3Aapache%2Fnetbeans%20com.sun.tools.classfile&type=code

Would be good to try to remove usage within NB and remove it from nb-javac too or switch to JEP 484 somehow (hopefully without having to ship it with nb-javac since that would likely no longer be possible for several reasons).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.