Skip to content

Commit

Permalink
[NETBEANS-5828] : NB-Javac Upgrade to JDK-17 (#29)
Browse files Browse the repository at this point in the history
* [NETBEANS-5828] : Resolved auto merge conflicts from JDK-17+32
  • Loading branch information
singh-akhilesh committed Oct 8, 2021
1 parent c7acb02 commit a8245e1
Show file tree
Hide file tree
Showing 166 changed files with 4,290 additions and 1,539 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ javac.test.classpath=\
${build.dir}/lib/hamcrest-core-1.3.jar
debug.classpath=${run.classpath}
jnlp.enabled=false
nb-javac-ver=16.0.0.0
nb-javac-ver=17.0.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,23 @@ public enum SourceVersion {
* The version recognized by the Java Platform, Standard Edition
* 16.
*
* Additions in this release include pattern matching for {@code
* instanceof} and records.
*
* @since 16
*/
RELEASE_16;
RELEASE_16,

/**
* The version recognized by the Java Platform, Standard Edition
* 17.
*
* Additions in this release include sealed classes and
* restoration of always-strict floating-point semantics.
*
* @since 17
*/
RELEASE_17;

// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
Expand All @@ -232,7 +246,7 @@ public enum SourceVersion {
* {@return the latest source version that can be modeled}
*/
public static SourceVersion latest() {
return RELEASE_16;
return RELEASE_17;
}

private static final SourceVersion latestSupported = getLatestSupported();
Expand All @@ -246,10 +260,14 @@ public static SourceVersion latest() {
*/
private static SourceVersion getLatestSupported() {


try {
String specVersion = System.getProperty("java.specification.version");

switch (specVersion) {
case "17":
return RELEASE_17;

case "16":
return RELEASE_16;

Expand Down Expand Up @@ -279,6 +297,7 @@ private static SourceVersion getLatestSupported() {
}

return RELEASE_5;

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -66,33 +66,15 @@ public enum Modifier {
/** The modifier {@code static} */ STATIC,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code sealed}
* @since 15
* @since 17
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
SEALED,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code non-sealed}
* @since 15
* @since 17
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
NON_SEALED {
public String toString() {
return "non-sealed";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -201,12 +201,6 @@ default List<? extends RecordComponentElement> getRecordComponents() {
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
* Returns the permitted classes of this class or interface
* element in declaration order.
*
Expand All @@ -215,10 +209,8 @@ default List<? extends RecordComponentElement> getRecordComponents() {
*
* @return the permitted classes, or an empty list if there are none
*
* @since 15
* @since 17
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
default List<? extends TypeMirror> getPermittedSubclasses() {
return Collections.unmodifiableList(new ArrayList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* @see AbstractAnnotationValueVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)
public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @since 16
*/

@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)

public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @see AbstractTypeVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)
public abstract class AbstractTypeVisitor14<R, P> extends AbstractTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* @since 16
*/

@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)

public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
* @see ElementScanner9
* @since 16
*/
@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)
public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -656,6 +656,22 @@ boolean overrides(ExecutableElement overrider, ExecutableElement overridden,
*/
boolean isFunctionalInterface(TypeElement type);

/**
* {@return {@code true} if the module element is an automatic
* module, {@code false} otherwise}
*
* @implSpec
* The default implementation of this method returns {@code
* false}.
*
* @param module the module element being examined
* @jls 7.7.1 Dependences
* @since 17
*/
default boolean isAutomaticModule(ModuleElement module) {
return false;
}

/**
* Returns the record component for the given accessor. Returns null if the
* given method is not a record component accessor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* @see SimpleAnnotationValueVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)
public class SimpleAnnotationValueVisitor14<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* @since 16
*/

@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)

public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
* @see SimpleTypeVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)
public class SimpleTypeVisitor14<R, P> extends SimpleTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* @see TypeKindVisitor9
* @since 14
*/
@SupportedSourceVersion(RELEASE_16)
@SupportedSourceVersion(RELEASE_17)
public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(
* Returns file objects representing the given paths.
*
* @implSpec
* The default implementation converts each path to a file and calls
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
* IllegalArgumentException will be thrown if any of the paths
* cannot be converted to a file.
* The default implementation lazily converts each path to a file and calls
* {@link #getJavaFileObjectsFromFiles(Iterable) getJavaFileObjectsFromFiles}.
* {@code IllegalArgumentException} will be thrown
* if any of the paths cannot be converted to a file at the point the conversion happens.
*
* @param paths a list of paths
* @return a list of file objects
* @throws IllegalArgumentException if the list of paths includes
* a directory or if this file manager does not support any of the
* given paths.
* given paths
*
* @since 13
*/
Expand Down Expand Up @@ -229,10 +229,10 @@ public File next() {
* Returns file objects representing the given paths.
*
* @implSpec
* The default implementation converts each path to a file and calls
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
* IllegalArgumentException will be thrown if any of the paths
* cannot be converted to a file.
* The default implementation lazily converts each path to a file and calls
* {@link #getJavaFileObjectsFromPaths(Collection) getJavaFileObjectsFromPaths}.
* {@code IllegalArgumentException} will be thrown
* if any of the paths cannot be converted to a file at the point the conversion happens.
*
* @param paths a list of paths
* @return a list of file objects
Expand Down Expand Up @@ -273,7 +273,8 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
* @param files an array of files
* @return a list of file objects
* @throws IllegalArgumentException if the array of files includes
* a directory
* a directory or if this file manager does not support any of the
* given paths
* @throws NullPointerException if the given array contains null
* elements
*/
Expand All @@ -287,10 +288,15 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
* getJavaFileObjectsFromPaths({@linkplain java.util.Arrays#asList Arrays.asList}(paths))
* </pre>
*
* @implSpec
* The default implementation will only throw {@code NullPointerException}
* if {@linkplain #getJavaFileObjectsFromPaths(Collection)} throws it.
*
* @param paths an array of paths
* @return a list of file objects
* @throws IllegalArgumentException if the array of files includes
* a directory
* a directory or if this file manager does not support any of the
* given paths
* @throws NullPointerException if the given array contains null
* elements
*
Expand Down Expand Up @@ -357,10 +363,10 @@ void setLocation(Location location, Iterable<? extends File> files)
* will be cancelled.
*
* @implSpec
* The default implementation converts each path to a file and calls
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
* {@linkplain IllegalArgumentException IllegalArgumentException}
* will be thrown if any of the paths cannot be converted to a file.
* The default implementation lazily converts each path to a file and calls
* {@link #setLocation setLocation}.
* {@code IllegalArgumentException} will be thrown if any of the paths cannot
* be converted to a file at the point the conversion happens.
*
* @param location a location
* @param paths a list of paths, if {@code null} use the default
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
*/

package javax.tools;

/**
* Provides methods for locating tool providers, for example,
* providers of compilers. This class complements the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package com.sun.source.tree;

import jdk.internal.PreviewFeature;

/**
* A marker interface for {@code Tree}s that may be used as {@link CaseTree} labels.
*
* @since 17
*/
@PreviewFeature(feature=PreviewFeature.Feature.SWITCH_PATTERN_MATCHING, reflective=true)
public interface CaseLabelTree extends Tree {}

0 comments on commit a8245e1

Please sign in to comment.