Skip to content

Commit

Permalink
Merge pull request #8037 from lahodaj/upgrade-jdk-24-b27
Browse files Browse the repository at this point in the history
Upgrading nb-javac to JDK 24b29.
  • Loading branch information
mbien authored Dec 28, 2024
2 parents 874d3bd + c025747 commit 35b31ef
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
Expand Down Expand Up @@ -489,7 +491,7 @@ public Iterable<? extends TypeElement> getGlobalTypes(ElementAcceptor acceptor)
for (CompilationUnitTree unit : Collections.singletonList(info.getCompilationUnit())) {
TreePath path = new TreePath(unit);
Scope scope = trees.getScope(path);
while (scope instanceof JavacScope && !((JavacScope)scope).isStarImportScope()) {
while (scope instanceof JavacScope && ((JavacScope)scope).getScopeType() == ORDINARY_SCOPE_TYPE) {
for (Element local : scope.getLocalElements()) {
if (local.getKind().isClass() || local.getKind().isInterface()) {
if (acceptor.accept(local, null)) {
Expand Down Expand Up @@ -521,6 +523,21 @@ public Iterable<? extends TypeElement> getGlobalTypes(ElementAcceptor acceptor)
return membersList;
}

private static final Object ORDINARY_SCOPE_TYPE;
private static final Logger LOG = Logger.getLogger(ElementUtilities.class.getName());

static {
Object ordinary = null;

try {
ordinary = Enum.valueOf((Class<Enum>) Class.forName("com.sun.tools.javac.api.JavacScope$ScopeType"), "ORDINARY");
} catch (ClassNotFoundException ex) {
LOG.log(Level.FINE, null, ex);
}

ORDINARY_SCOPE_TYPE = ordinary;
}

/**Filter {@link Element}s
*/
public static interface ElementAcceptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public PlaceholderType(com.sun.tools.javac.util.List<TypeMetadata> md) {

@Override
public TypeTag getTag() {
return TypeTag.UNKNOWN;
return TypeTag.NONE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class NoJavacHelper {

public static final int REQUIRED_JAVAC_VERSION = 23; // <- TODO: increment on every release
public static final int REQUIRED_JAVAC_VERSION = 24; // <- TODO: increment on every release
private static final boolean HAS_WORKING_JAVAC;

static {
Expand Down
4 changes: 2 additions & 2 deletions java/libs.javacapi/external/binaries-list
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
1B70EC8A5230901C0EEE6EDF9829B43EAFAE9CC9 com.dukescript.nbjavac:nb-javac:jdk-23+35
B3CB7A425EC7AAADA60754E6DF2E5E2D990E91AE com.dukescript.nbjavac:nb-javac:jdk-23+35:api
3AA17DB68CB7E39E9DE17F566FCD1787BDD03E16 com.dukescript.nbjavac:nb-javac:jdk-24+29
92F6565B6FB8F397CEB90308A47202E30E27A167 com.dukescript.nbjavac:nb-javac:jdk-24+29:api
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: Javac Compiler Implementation
Description: Javac Compiler Implementation
Version: 23+35
Files: nb-javac-jdk-23+35-api.jar nb-javac-jdk-23+35.jar
Version: 24+29
Files: nb-javac-jdk-24+29-api.jar nb-javac-jdk-24+29.jar
License: GPL-2-CP
Origin: OpenJDK (https://github.com/openjdk/jdk)
Source: https://github.com/openjdk/jdk
Expand Down
4 changes: 2 additions & 2 deletions java/libs.javacapi/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
</public-packages>
<class-path-extension>
<runtime-relative-path />
<binary-origin>external/nb-javac-jdk-23+35-api.jar</binary-origin>
<binary-origin>external/nb-javac-jdk-24+29-api.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path />
<binary-origin>external/nb-javac-jdk-23+35.jar</binary-origin>
<binary-origin>external/nb-javac-jdk-24+29.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions java/libs.nbjavacapi/external/binaries-list
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
1B70EC8A5230901C0EEE6EDF9829B43EAFAE9CC9 com.dukescript.nbjavac:nb-javac:jdk-23+35
B3CB7A425EC7AAADA60754E6DF2E5E2D990E91AE com.dukescript.nbjavac:nb-javac:jdk-23+35:api
3AA17DB68CB7E39E9DE17F566FCD1787BDD03E16 com.dukescript.nbjavac:nb-javac:jdk-24+29
92F6565B6FB8F397CEB90308A47202E30E27A167 com.dukescript.nbjavac:nb-javac:jdk-24+29:api
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: Javac Compiler Implementation
Description: Javac Compiler Implementation
Version: 23+35
Files: nb-javac-jdk-23+35-api.jar nb-javac-jdk-23+35.jar
Version: 24+29
Files: nb-javac-jdk-24+29-api.jar nb-javac-jdk-24+29.jar
License: GPL-2-CP
Origin: OpenJDK (https://github.com/openjdk/jdk)
Source: https://github.com/openjdk/jdk
Expand Down
4 changes: 2 additions & 2 deletions java/libs.nbjavacapi/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
javac.source=1.8
javac.compilerargs=-Xlint -Xlint:-serial
license.file.override=${nb_all}/nbbuild/licenses/GPL-2-CP
release.external/nb-javac-jdk-23+35-api.jar=modules/ext/nb-javac-jdk-23-30-api.jar
release.external/nb-javac-jdk-23+35.jar=modules/ext/nb-javac-jdk-23-30.jar
release.external/nb-javac-jdk-24+29-api.jar=modules/ext/nb-javac-jdk-24-29-api.jar
release.external/nb-javac-jdk-24+29.jar=modules/ext/nb-javac-jdk-24-29.jar

# for tests
requires.nb.javac=true
8 changes: 4 additions & 4 deletions java/libs.nbjavacapi/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
</test-dependencies>
<public-packages/>
<class-path-extension>
<runtime-relative-path>ext/nb-javac-jdk-23-30-api.jar</runtime-relative-path>
<binary-origin>external/nb-javac-jdk-23+35-api.jar</binary-origin>
<runtime-relative-path>ext/nb-javac-jdk-24-29-api.jar</runtime-relative-path>
<binary-origin>external/nb-javac-jdk-24+29-api.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/nb-javac-jdk-23-30.jar</runtime-relative-path>
<binary-origin>external/nb-javac-jdk-23+35.jar</binary-origin>
<runtime-relative-path>ext/nb-javac-jdk-24-29.jar</runtime-relative-path>
<binary-origin>external/nb-javac-jdk-24+29.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
OpenIDE-Module-Display-Category=Java
OpenIDE-Module-Long-Description=\
This library provides a Java language parser for the IDE. \
Supports JDK-23 features.
Supports JDK-24 features.
OpenIDE-Module-Name=The nb-javac Java editing support library
OpenIDE-Module-Short-Description=The nb-javac Java editing support library
4 changes: 2 additions & 2 deletions nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ nb/ide.launcher/external/launcher-external-binaries-1-94a19f0.zip platform/o.n.b
nb/ide.launcher/external/launcher-external-binaries-1-94a19f0.zip harness/apisupport.harness/external/launcher-external-binaries-1-94a19f0.zip

# only one is part of the product:
java/libs.javacapi/external/nb-javac-jdk-23+35-api.jar java/libs.nbjavacapi/external/nb-javac-jdk-23+35-api.jar
java/libs.javacapi/external/nb-javac-jdk-23+35.jar java/libs.nbjavacapi/external/nb-javac-jdk-23+35.jar
java/libs.javacapi/external/nb-javac-jdk-24+29-api.jar java/libs.nbjavacapi/external/nb-javac-jdk-24+29-api.jar
java/libs.javacapi/external/nb-javac-jdk-24+29.jar java/libs.nbjavacapi/external/nb-javac-jdk-24+29.jar

# Used only in unittests for mysql db specific tests
ide/db.metadata.model/external/mysql-connector-j-8.0.31.jar ide/db.mysql/external/mysql-connector-j-8.0.31.jar
Expand Down

0 comments on commit 35b31ef

Please sign in to comment.