Skip to content

Commit a8245e1

Browse files
[NETBEANS-5828] : NB-Javac Upgrade to JDK-17 (#29)
* [NETBEANS-5828] : Resolved auto merge conflicts from JDK-17+32
1 parent c7acb02 commit a8245e1

File tree

166 files changed

+4290
-1539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+4290
-1539
lines changed

make/langtools/netbeans/nb-javac/nbproject/project.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ javac.test.classpath=\
104104
${build.dir}/lib/hamcrest-core-1.3.jar
105105
debug.classpath=${run.classpath}
106106
jnlp.enabled=false
107-
nb-javac-ver=16.0.0.0
107+
nb-javac-ver=17.0.0.0

src/java.compiler/share/classes/javax/lang/model/SourceVersion.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,23 @@ public enum SourceVersion {
221221
* The version recognized by the Java Platform, Standard Edition
222222
* 16.
223223
*
224+
* Additions in this release include pattern matching for {@code
225+
* instanceof} and records.
226+
*
224227
* @since 16
225228
*/
226-
RELEASE_16;
229+
RELEASE_16,
230+
231+
/**
232+
* The version recognized by the Java Platform, Standard Edition
233+
* 17.
234+
*
235+
* Additions in this release include sealed classes and
236+
* restoration of always-strict floating-point semantics.
237+
*
238+
* @since 17
239+
*/
240+
RELEASE_17;
227241

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

238252
private static final SourceVersion latestSupported = getLatestSupported();
@@ -246,10 +260,14 @@ public static SourceVersion latest() {
246260
*/
247261
private static SourceVersion getLatestSupported() {
248262

263+
249264
try {
250265
String specVersion = System.getProperty("java.specification.version");
251266

252267
switch (specVersion) {
268+
case "17":
269+
return RELEASE_17;
270+
253271
case "16":
254272
return RELEASE_16;
255273

@@ -279,6 +297,7 @@ private static SourceVersion getLatestSupported() {
279297
}
280298

281299
return RELEASE_5;
300+
282301
}
283302

284303

src/java.compiler/share/classes/javax/lang/model/element/Modifier.java

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

6868
/**
69-
* {@preview Associated with sealed classes, a preview feature of the Java language.
70-
*
71-
* This enum constant is associated with <i>sealed classes</i>, a preview
72-
* feature of the Java language. Preview features
73-
* may be removed in a future release, or upgraded to permanent
74-
* features of the Java language.}
75-
*
7669
* The modifier {@code sealed}
77-
* @since 15
70+
* @since 17
7871
*/
79-
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
80-
essentialAPI=false)
8172
SEALED,
8273

8374
/**
84-
* {@preview Associated with sealed classes, a preview feature of the Java language.
85-
*
86-
* This enum constant is associated with <i>sealed classes</i>, a preview
87-
* feature of the Java language. Preview features
88-
* may be removed in a future release, or upgraded to permanent
89-
* features of the Java language.}
90-
*
9175
* The modifier {@code non-sealed}
92-
* @since 15
76+
* @since 17
9377
*/
94-
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
95-
essentialAPI=false)
9678
NON_SEALED {
9779
public String toString() {
9880
return "non-sealed";

src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -201,12 +201,6 @@ default List<? extends RecordComponentElement> getRecordComponents() {
201201
}
202202

203203
/**
204-
* {@preview Associated with sealed classes, a preview feature of the Java language.
205-
*
206-
* This method is associated with <i>sealed classes</i>, a preview
207-
* feature of the Java language. Preview features
208-
* may be removed in a future release, or upgraded to permanent
209-
* features of the Java language.}
210204
* Returns the permitted classes of this class or interface
211205
* element in declaration order.
212206
*
@@ -215,10 +209,8 @@ default List<? extends RecordComponentElement> getRecordComponents() {
215209
*
216210
* @return the permitted classes, or an empty list if there are none
217211
*
218-
* @since 15
212+
* @since 17
219213
*/
220-
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
221-
essentialAPI=false)
222214
default List<? extends TypeMirror> getPermittedSubclasses() {
223215
return Collections.unmodifiableList(new ArrayList());
224216
}

src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* @see AbstractAnnotationValueVisitor9
4545
* @since 14
4646
*/
47-
@SupportedSourceVersion(RELEASE_16)
47+
@SupportedSourceVersion(RELEASE_17)
4848
public abstract class AbstractAnnotationValueVisitor14<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
4949

5050
/**

src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* @since 16
5151
*/
5252

53-
@SupportedSourceVersion(RELEASE_16)
53+
@SupportedSourceVersion(RELEASE_17)
5454

5555
public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
5656
/**

src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* @see AbstractTypeVisitor9
4848
* @since 14
4949
*/
50-
@SupportedSourceVersion(RELEASE_16)
50+
@SupportedSourceVersion(RELEASE_17)
5151
public abstract class AbstractTypeVisitor14<R, P> extends AbstractTypeVisitor9<R, P> {
5252
/**
5353
* Constructor for concrete subclasses to call.

src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
* @since 16
6363
*/
6464

65-
@SupportedSourceVersion(RELEASE_16)
65+
@SupportedSourceVersion(RELEASE_17)
6666

6767
public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
6868
/**

src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
* @see ElementScanner9
7777
* @since 16
7878
*/
79-
@SupportedSourceVersion(RELEASE_16)
79+
@SupportedSourceVersion(RELEASE_17)
8080
public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
8181
/**
8282
* Constructor for concrete subclasses; uses {@code null} for the

src/java.compiler/share/classes/javax/lang/model/util/Elements.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -656,6 +656,22 @@ boolean overrides(ExecutableElement overrider, ExecutableElement overridden,
656656
*/
657657
boolean isFunctionalInterface(TypeElement type);
658658

659+
/**
660+
* {@return {@code true} if the module element is an automatic
661+
* module, {@code false} otherwise}
662+
*
663+
* @implSpec
664+
* The default implementation of this method returns {@code
665+
* false}.
666+
*
667+
* @param module the module element being examined
668+
* @jls 7.7.1 Dependences
669+
* @since 17
670+
*/
671+
default boolean isAutomaticModule(ModuleElement module) {
672+
return false;
673+
}
674+
659675
/**
660676
* Returns the record component for the given accessor. Returns null if the
661677
* given method is not a record component accessor.

src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* @see SimpleAnnotationValueVisitor9
5353
* @since 14
5454
*/
55-
@SupportedSourceVersion(RELEASE_16)
55+
@SupportedSourceVersion(RELEASE_17)
5656
public class SimpleAnnotationValueVisitor14<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
5757
/**
5858
* Constructor for concrete subclasses; uses {@code null} for the

src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* @since 16
5959
*/
6060

61-
@SupportedSourceVersion(RELEASE_16)
61+
@SupportedSourceVersion(RELEASE_17)
6262

6363
public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
6464
/**

src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* @see SimpleTypeVisitor9
5757
* @since 14
5858
*/
59-
@SupportedSourceVersion(RELEASE_16)
59+
@SupportedSourceVersion(RELEASE_17)
6060
public class SimpleTypeVisitor14<R, P> extends SimpleTypeVisitor9<R, P> {
6161
/**
6262
* Constructor for concrete subclasses; uses {@code null} for the

src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* @see TypeKindVisitor9
6262
* @since 14
6363
*/
64-
@SupportedSourceVersion(RELEASE_16)
64+
@SupportedSourceVersion(RELEASE_17)
6565
public class TypeKindVisitor14<R, P> extends TypeKindVisitor9<R, P> {
6666
/**
6767
* Constructor for concrete subclasses to call; uses {@code null}

src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java

+21-15
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(
190190
* Returns file objects representing the given paths.
191191
*
192192
* @implSpec
193-
* The default implementation converts each path to a file and calls
194-
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
195-
* IllegalArgumentException will be thrown if any of the paths
196-
* cannot be converted to a file.
193+
* The default implementation lazily converts each path to a file and calls
194+
* {@link #getJavaFileObjectsFromFiles(Iterable) getJavaFileObjectsFromFiles}.
195+
* {@code IllegalArgumentException} will be thrown
196+
* if any of the paths cannot be converted to a file at the point the conversion happens.
197197
*
198198
* @param paths a list of paths
199199
* @return a list of file objects
200200
* @throws IllegalArgumentException if the list of paths includes
201201
* a directory or if this file manager does not support any of the
202-
* given paths.
202+
* given paths
203203
*
204204
* @since 13
205205
*/
@@ -229,10 +229,10 @@ public File next() {
229229
* Returns file objects representing the given paths.
230230
*
231231
* @implSpec
232-
* The default implementation converts each path to a file and calls
233-
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
234-
* IllegalArgumentException will be thrown if any of the paths
235-
* cannot be converted to a file.
232+
* The default implementation lazily converts each path to a file and calls
233+
* {@link #getJavaFileObjectsFromPaths(Collection) getJavaFileObjectsFromPaths}.
234+
* {@code IllegalArgumentException} will be thrown
235+
* if any of the paths cannot be converted to a file at the point the conversion happens.
236236
*
237237
* @param paths a list of paths
238238
* @return a list of file objects
@@ -273,7 +273,8 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
273273
* @param files an array of files
274274
* @return a list of file objects
275275
* @throws IllegalArgumentException if the array of files includes
276-
* a directory
276+
* a directory or if this file manager does not support any of the
277+
* given paths
277278
* @throws NullPointerException if the given array contains null
278279
* elements
279280
*/
@@ -287,10 +288,15 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
287288
* getJavaFileObjectsFromPaths({@linkplain java.util.Arrays#asList Arrays.asList}(paths))
288289
* </pre>
289290
*
291+
* @implSpec
292+
* The default implementation will only throw {@code NullPointerException}
293+
* if {@linkplain #getJavaFileObjectsFromPaths(Collection)} throws it.
294+
*
290295
* @param paths an array of paths
291296
* @return a list of file objects
292297
* @throws IllegalArgumentException if the array of files includes
293-
* a directory
298+
* a directory or if this file manager does not support any of the
299+
* given paths
294300
* @throws NullPointerException if the given array contains null
295301
* elements
296302
*
@@ -357,10 +363,10 @@ void setLocation(Location location, Iterable<? extends File> files)
357363
* will be cancelled.
358364
*
359365
* @implSpec
360-
* The default implementation converts each path to a file and calls
361-
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
362-
* {@linkplain IllegalArgumentException IllegalArgumentException}
363-
* will be thrown if any of the paths cannot be converted to a file.
366+
* The default implementation lazily converts each path to a file and calls
367+
* {@link #setLocation setLocation}.
368+
* {@code IllegalArgumentException} will be thrown if any of the paths cannot
369+
* be converted to a file at the point the conversion happens.
364370
*
365371
* @param location a location
366372
* @param paths a list of paths, if {@code null} use the default

src/java.compiler/share/classes/javax/tools/ToolProvider.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,6 @@
2424
*/
2525

2626
package javax.tools;
27-
2827
/**
2928
* Provides methods for locating tool providers, for example,
3029
* providers of compilers. This class complements the
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
package com.sun.source.tree;
27+
28+
import jdk.internal.PreviewFeature;
29+
30+
/**
31+
* A marker interface for {@code Tree}s that may be used as {@link CaseTree} labels.
32+
*
33+
* @since 17
34+
*/
35+
@PreviewFeature(feature=PreviewFeature.Feature.SWITCH_PATTERN_MATCHING, reflective=true)
36+
public interface CaseLabelTree extends Tree {}

0 commit comments

Comments
 (0)