Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2020-09-16 03:59:22 +0000
committerJay Arthanareeswaran2020-09-16 03:59:22 +0000
commit27b53ca171a19db4794ec310f4e339e876ea495f (patch)
tree3b12fd95b0afb9a5401d836d115751d13588c5c0
parenta8b03f929def2f6a9f479a198856e34e6cd4af34 (diff)
parent0a27063a3e6012ba850fd756f98be50be0375dc3 (diff)
downloadeclipse.jdt.core-27b53ca171a19db4794ec310f4e339e876ea495f.tar.gz
eclipse.jdt.core-27b53ca171a19db4794ec310f4e339e876ea495f.tar.xz
eclipse.jdt.core-27b53ca171a19db4794ec310f4e339e876ea495f.zip
Merge remote-tracking branch 'origin/BETA_JAVA15'
-rw-r--r--JCL/.gitignore1
-rw-r--r--JCL/converterJclMin/.classpath6
-rw-r--r--JCL/converterJclMin/.project17
-rw-r--r--JCL/converterJclMin/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--JCL/converterJclMin/src/java/awt/List.java15
-rw-r--r--JCL/converterJclMin/src/java/awt/Point.java7
-rw-r--r--JCL/converterJclMin/src/java/io/BufferedInputStream.java17
-rw-r--r--JCL/converterJclMin/src/java/io/BufferedOutputStream.java17
-rw-r--r--JCL/converterJclMin/src/java/io/BufferedWriter.java22
-rw-r--r--JCL/converterJclMin/src/java/io/ByteArrayInputStream.java17
-rw-r--r--JCL/converterJclMin/src/java/io/ByteArrayOutputStream.java16
-rw-r--r--JCL/converterJclMin/src/java/io/File.java46
-rw-r--r--JCL/converterJclMin/src/java/io/FileInputStream.java18
-rw-r--r--JCL/converterJclMin/src/java/io/FileOutputStream.java19
-rw-r--r--JCL/converterJclMin/src/java/io/FileWriter.java24
-rw-r--r--JCL/converterJclMin/src/java/io/IOException.java20
-rw-r--r--JCL/converterJclMin/src/java/io/InputStream.java22
-rw-r--r--JCL/converterJclMin/src/java/io/InputStreamReader.java22
-rw-r--r--JCL/converterJclMin/src/java/io/InterruptedIOException.java15
-rw-r--r--JCL/converterJclMin/src/java/io/OutputStream.java22
-rw-r--r--JCL/converterJclMin/src/java/io/PrintStream.java35
-rw-r--r--JCL/converterJclMin/src/java/io/PrintWriter.java28
-rw-r--r--JCL/converterJclMin/src/java/io/Reader.java16
-rw-r--r--JCL/converterJclMin/src/java/io/Serializable.java15
-rw-r--r--JCL/converterJclMin/src/java/io/StringWriter.java23
-rw-r--r--JCL/converterJclMin/src/java/io/UnsupportedEncodingException.java19
-rw-r--r--JCL/converterJclMin/src/java/io/Writer.java19
-rw-r--r--JCL/converterJclMin/src/java/lang/ArithmeticException.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/ArrayIndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/AssertionError.java30
-rw-r--r--JCL/converterJclMin/src/java/lang/Boolean.java19
-rw-r--r--JCL/converterJclMin/src/java/lang/Byte.java41
-rw-r--r--JCL/converterJclMin/src/java/lang/Character.java39
-rw-r--r--JCL/converterJclMin/src/java/lang/Class.java22
-rw-r--r--JCL/converterJclMin/src/java/lang/ClassCastException.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/ClassNotFoundException.java20
-rw-r--r--JCL/converterJclMin/src/java/lang/CloneNotSupportedException.java14
-rw-r--r--JCL/converterJclMin/src/java/lang/Cloneable.java15
-rw-r--r--JCL/converterJclMin/src/java/lang/Comparable.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/Double.java56
-rw-r--r--JCL/converterJclMin/src/java/lang/Error.java21
-rw-r--r--JCL/converterJclMin/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin/src/java/lang/ExceptionInInitializerError.java17
-rw-r--r--JCL/converterJclMin/src/java/lang/Float.java53
-rw-r--r--JCL/converterJclMin/src/java/lang/IllegalMonitorStateException.java18
-rw-r--r--JCL/converterJclMin/src/java/lang/IndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/Integer.java54
-rw-r--r--JCL/converterJclMin/src/java/lang/InterruptedException.java14
-rw-r--r--JCL/converterJclMin/src/java/lang/Long.java42
-rw-r--r--JCL/converterJclMin/src/java/lang/Math.java24
-rw-r--r--JCL/converterJclMin/src/java/lang/NoSuchFieldError.java15
-rw-r--r--JCL/converterJclMin/src/java/lang/NullPointerException.java30
-rw-r--r--JCL/converterJclMin/src/java/lang/Number.java25
-rw-r--r--JCL/converterJclMin/src/java/lang/NumberFormatException.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/Object.java47
-rw-r--r--JCL/converterJclMin/src/java/lang/ReflectiveOperationException.java26
-rw-r--r--JCL/converterJclMin/src/java/lang/Runnable.java16
-rw-r--r--JCL/converterJclMin/src/java/lang/RuntimeException.java19
-rw-r--r--JCL/converterJclMin/src/java/lang/Short.java41
-rw-r--r--JCL/converterJclMin/src/java/lang/String.java75
-rw-r--r--JCL/converterJclMin/src/java/lang/StringBuffer.java59
-rw-r--r--JCL/converterJclMin/src/java/lang/System.java24
-rw-r--r--JCL/converterJclMin/src/java/lang/Throwable.java33
-rw-r--r--JCL/converterJclMin/src/java/lang/Void.java13
-rw-r--r--JCL/converterJclMin/src/java/lang/ref/Reference.java17
-rw-r--r--JCL/converterJclMin/src/java/lang/ref/ReferenceQueue.java17
-rw-r--r--JCL/converterJclMin/src/java/lang/ref/WeakReference.java17
-rw-r--r--JCL/converterJclMin/src/java/net/MalformedURLException.java15
-rw-r--r--JCL/converterJclMin/src/java/text/NumberFormat.java22
-rw-r--r--JCL/converterJclMin/src/java/util/ArrayList.java48
-rw-r--r--JCL/converterJclMin/src/java/util/Arrays.java17
-rw-r--r--JCL/converterJclMin/src/java/util/Collection.java19
-rw-r--r--JCL/converterJclMin/src/java/util/Collections.java17
-rw-r--r--JCL/converterJclMin/src/java/util/Enumeration.java18
-rw-r--r--JCL/converterJclMin/src/java/util/HashMap.java33
-rw-r--r--JCL/converterJclMin/src/java/util/Hashtable.java33
-rw-r--r--JCL/converterJclMin/src/java/util/Iterator.java17
-rw-r--r--JCL/converterJclMin/src/java/util/List.java16
-rw-r--r--JCL/converterJclMin/src/java/util/Locale.java17
-rw-r--r--JCL/converterJclMin/src/java/util/Map.java18
-rw-r--r--JCL/converterJclMin/src/java/util/MissingResourceException.java16
-rw-r--r--JCL/converterJclMin/src/java/util/NoSuchElementException.java16
-rw-r--r--JCL/converterJclMin/src/java/util/ResourceBundle.java23
-rw-r--r--JCL/converterJclMin/src/java/util/Set.java18
-rw-r--r--JCL/converterJclMin/src/java/util/StringTokenizer.java29
-rw-r--r--JCL/converterJclMin/src/java/util/Vector.java28
-rw-r--r--JCL/converterJclMin/src/java/util/zip/ZipEntry.java18
-rw-r--r--JCL/converterJclMin/src/java/util/zip/ZipFile.java23
-rw-r--r--JCL/converterJclMin1.5/.classpath6
-rw-r--r--JCL/converterJclMin1.5/.project17
-rw-r--r--JCL/converterJclMin1.5/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--JCL/converterJclMin1.5/src/java/awt/List.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/io/BufferedInputStream.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/io/BufferedOutputStream.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/io/BufferedWriter.java22
-rw-r--r--JCL/converterJclMin1.5/src/java/io/ByteArrayInputStream.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/io/ByteArrayOutputStream.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/io/File.java46
-rw-r--r--JCL/converterJclMin1.5/src/java/io/FileInputStream.java18
-rw-r--r--JCL/converterJclMin1.5/src/java/io/FileOutputStream.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/io/FileWriter.java24
-rw-r--r--JCL/converterJclMin1.5/src/java/io/IOException.java20
-rw-r--r--JCL/converterJclMin1.5/src/java/io/InputStream.java22
-rw-r--r--JCL/converterJclMin1.5/src/java/io/InputStreamReader.java22
-rw-r--r--JCL/converterJclMin1.5/src/java/io/InterruptedIOException.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/io/OutputStream.java22
-rw-r--r--JCL/converterJclMin1.5/src/java/io/PrintStream.java35
-rw-r--r--JCL/converterJclMin1.5/src/java/io/PrintWriter.java28
-rw-r--r--JCL/converterJclMin1.5/src/java/io/Reader.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/io/Serializable.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/io/StringWriter.java23
-rw-r--r--JCL/converterJclMin1.5/src/java/io/UnsupportedEncodingException.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/io/Writer.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ArithmeticException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ArrayIndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/AssertionError.java30
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Boolean.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Byte.java45
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Character.java39
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Class.java32
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ClassCastException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ClassNotFoundException.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/CloneNotSupportedException.java14
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Cloneable.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Comparable.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Deprecated.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Double.java61
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Enum.java36
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Error.java21
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ExceptionInInitializerError.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Float.java57
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/IllegalAccessException.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/IllegalMonitorStateException.java18
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/IndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/InstantiationException.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Integer.java59
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/InterruptedException.java14
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Iterable.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Long.java46
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Math.java24
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/NoSuchFieldError.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/NullPointerException.java30
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Number.java26
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/NumberFormatException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Object.java45
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Override.java20
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Runnable.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/RuntimeException.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Short.java45
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/String.java77
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/StringBuffer.java59
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/SuppressWarnings.java11
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/System.java24
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Throwable.java33
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/Void.java13
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/annotation/Annotation.java21
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/annotation/ElementType.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/annotation/Retention.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/annotation/RetentionPolicy.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/annotation/Target.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ref/Reference.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ref/ReferenceQueue.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/lang/ref/WeakReference.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/net/MalformedURLException.java15
-rw-r--r--JCL/converterJclMin1.5/src/java/text/NumberFormat.java22
-rw-r--r--JCL/converterJclMin1.5/src/java/util/AbstractCollection.java4
-rw-r--r--JCL/converterJclMin1.5/src/java/util/AbstractList.java4
-rw-r--r--JCL/converterJclMin1.5/src/java/util/AbstractSet.java4
-rw-r--r--JCL/converterJclMin1.5/src/java/util/ArrayList.java50
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Arrays.java20
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Collection.java19
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Collections.java23
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Enumeration.java18
-rw-r--r--JCL/converterJclMin1.5/src/java/util/HashMap.java33
-rw-r--r--JCL/converterJclMin1.5/src/java/util/HashSet.java22
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Hashtable.java33
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Iterator.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/util/List.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Locale.java17
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Map.java18
-rw-r--r--JCL/converterJclMin1.5/src/java/util/MissingResourceException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/util/NoSuchElementException.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/util/RandomAccess.java3
-rw-r--r--JCL/converterJclMin1.5/src/java/util/ResourceBundle.java23
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Set.java16
-rw-r--r--JCL/converterJclMin1.5/src/java/util/StringTokenizer.java29
-rw-r--r--JCL/converterJclMin1.5/src/java/util/Vector.java32
-rw-r--r--JCL/converterJclMin1.5/src/java/util/zip/ZipEntry.java18
-rw-r--r--JCL/converterJclMin1.5/src/java/util/zip/ZipFile.java23
-rw-r--r--JCL/converterJclMin1.5/src/p1/p2/Annot.java8
-rw-r--r--JCL/converterJclMin1.5/src/p1/p2/MyEnum.java17
-rw-r--r--JCL/converterJclMin1.5/src/p1/p2/MyEnum2.java7
-rw-r--r--JCL/converterJclMin1.7/.classpath6
-rw-r--r--JCL/converterJclMin1.7/.project17
-rw-r--r--JCL/converterJclMin1.7/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--JCL/converterJclMin1.7/src/java/awt/List.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/io/BufferedInputStream.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/io/BufferedOutputStream.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/io/BufferedWriter.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/io/ByteArrayInputStream.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/io/ByteArrayOutputStream.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/io/File.java46
-rw-r--r--JCL/converterJclMin1.7/src/java/io/FileInputStream.java18
-rw-r--r--JCL/converterJclMin1.7/src/java/io/FileOutputStream.java19
-rw-r--r--JCL/converterJclMin1.7/src/java/io/FileWriter.java24
-rw-r--r--JCL/converterJclMin1.7/src/java/io/IOException.java20
-rw-r--r--JCL/converterJclMin1.7/src/java/io/InputStream.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/io/InputStreamReader.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/io/InterruptedIOException.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/io/OutputStream.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/io/PrintStream.java35
-rw-r--r--JCL/converterJclMin1.7/src/java/io/PrintWriter.java28
-rw-r--r--JCL/converterJclMin1.7/src/java/io/Reader.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/io/Serializable.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/io/StringWriter.java23
-rw-r--r--JCL/converterJclMin1.7/src/java/io/UnsupportedEncodingException.java20
-rw-r--r--JCL/converterJclMin1.7/src/java/io/Writer.java19
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ArithmeticException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ArrayIndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/AssertionError.java30
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Boolean.java19
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Byte.java45
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Character.java39
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Class.java32
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ClassCastException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ClassNotFoundException.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/CloneNotSupportedException.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Cloneable.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Comparable.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Deprecated.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Double.java61
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Enum.java36
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Error.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Exception.java20
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ExceptionInInitializerError.java19
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Float.java57
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/IllegalAccessException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/IllegalMonitorStateException.java19
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/IndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/InstantiationException.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Integer.java59
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/InterruptedException.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Iterable.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Long.java46
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Math.java24
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/NoSuchMethodException.java28
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/NullPointerException.java31
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Number.java26
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/NumberFormatException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Object.java45
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Override.java20
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ReflectiveOperationException.java13
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Runnable.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/RuntimeException.java20
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/SafeVarargs.java12
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Short.java45
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/String.java77
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/StringBuffer.java59
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/SuppressWarnings.java11
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/System.java24
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Throwable.java35
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/Void.java13
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/annotation/Annotation.java21
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/annotation/Documented.java10
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/annotation/ElementType.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/annotation/Retention.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/annotation/RetentionPolicy.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/annotation/Target.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandle.java37
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/invoke/MethodType.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ref/Reference.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ref/ReferenceQueue.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/lang/ref/WeakReference.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/net/MalformedURLException.java15
-rw-r--r--JCL/converterJclMin1.7/src/java/text/NumberFormat.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/util/AbstractCollection.java4
-rw-r--r--JCL/converterJclMin1.7/src/java/util/AbstractList.java4
-rw-r--r--JCL/converterJclMin1.7/src/java/util/AbstractSet.java4
-rw-r--r--JCL/converterJclMin1.7/src/java/util/ArrayList.java50
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Arrays.java21
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Collection.java19
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Collections.java23
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Enumeration.java18
-rw-r--r--JCL/converterJclMin1.7/src/java/util/HashMap.java33
-rw-r--r--JCL/converterJclMin1.7/src/java/util/HashSet.java22
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Hashtable.java33
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Iterator.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/util/List.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Locale.java17
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Map.java18
-rw-r--r--JCL/converterJclMin1.7/src/java/util/MissingResourceException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/util/NoSuchElementException.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/util/RandomAccess.java3
-rw-r--r--JCL/converterJclMin1.7/src/java/util/ResourceBundle.java23
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Set.java16
-rw-r--r--JCL/converterJclMin1.7/src/java/util/StringTokenizer.java29
-rw-r--r--JCL/converterJclMin1.7/src/java/util/Vector.java32
-rw-r--r--JCL/converterJclMin1.7/src/java/util/zip/ZipEntry.java18
-rw-r--r--JCL/converterJclMin1.7/src/java/util/zip/ZipFile.java23
-rw-r--r--JCL/converterJclMin1.8/.classpath6
-rw-r--r--JCL/converterJclMin1.8/.project17
-rw-r--r--JCL/converterJclMin1.8/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--JCL/converterJclMin1.8/src/java/awt/List.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/io/BufferedInputStream.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/io/BufferedOutputStream.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/io/BufferedWriter.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/io/ByteArrayInputStream.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/io/ByteArrayOutputStream.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/io/File.java46
-rw-r--r--JCL/converterJclMin1.8/src/java/io/FileInputStream.java18
-rw-r--r--JCL/converterJclMin1.8/src/java/io/FileOutputStream.java19
-rw-r--r--JCL/converterJclMin1.8/src/java/io/FileWriter.java24
-rw-r--r--JCL/converterJclMin1.8/src/java/io/IOException.java20
-rw-r--r--JCL/converterJclMin1.8/src/java/io/InputStream.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/io/InputStreamReader.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/io/InterruptedIOException.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/io/OutputStream.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/io/PrintStream.java35
-rw-r--r--JCL/converterJclMin1.8/src/java/io/PrintWriter.java28
-rw-r--r--JCL/converterJclMin1.8/src/java/io/Reader.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/io/Serializable.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/io/StringWriter.java23
-rw-r--r--JCL/converterJclMin1.8/src/java/io/UnsupportedEncodingException.java20
-rw-r--r--JCL/converterJclMin1.8/src/java/io/Writer.java19
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ArithmeticException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ArrayIndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/AssertionError.java30
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/AutoCloseable.java5
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Boolean.java19
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Byte.java45
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Character.java39
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Class.java32
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ClassCastException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ClassNotFoundException.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/CloneNotSupportedException.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Cloneable.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Comparable.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Deprecated.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Double.java61
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Enum.java36
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Error.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Exception.java20
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ExceptionInInitializerError.java19
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Float.java57
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/IllegalAccessException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/IllegalMonitorStateException.java19
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/IndexOutOfBoundsException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/InstantiationException.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Integer.java59
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/InterruptedException.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Iterable.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Long.java46
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Math.java24
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/NoSuchMethodException.java28
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/NullPointerException.java31
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Number.java26
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/NumberFormatException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Object.java45
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Override.java20
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ReflectiveOperationException.java13
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Runnable.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/RuntimeException.java20
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/SafeVarargs.java12
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Short.java45
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/String.java77
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/StringBuffer.java59
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/SuppressWarnings.java11
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/System.java24
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Throwable.java35
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/Void.java13
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/annotation/Annotation.java21
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/annotation/Documented.java10
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/annotation/ElementType.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/annotation/Retention.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/annotation/RetentionPolicy.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/annotation/Target.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/invoke/LambdaMetafactory.java35
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandle.java37
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/invoke/MethodType.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ref/Reference.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ref/ReferenceQueue.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/lang/ref/WeakReference.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/net/MalformedURLException.java15
-rw-r--r--JCL/converterJclMin1.8/src/java/text/NumberFormat.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/util/AbstractCollection.java4
-rw-r--r--JCL/converterJclMin1.8/src/java/util/AbstractList.java4
-rw-r--r--JCL/converterJclMin1.8/src/java/util/AbstractSet.java4
-rw-r--r--JCL/converterJclMin1.8/src/java/util/ArrayList.java50
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Arrays.java21
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Collection.java19
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Collections.java23
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Enumeration.java18
-rw-r--r--JCL/converterJclMin1.8/src/java/util/HashMap.java33
-rw-r--r--JCL/converterJclMin1.8/src/java/util/HashSet.java22
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Hashtable.java33
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Iterator.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/util/List.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Locale.java17
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Map.java18
-rw-r--r--JCL/converterJclMin1.8/src/java/util/MissingResourceException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/util/NoSuchElementException.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/util/RandomAccess.java3
-rw-r--r--JCL/converterJclMin1.8/src/java/util/ResourceBundle.java23
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Set.java16
-rw-r--r--JCL/converterJclMin1.8/src/java/util/StringTokenizer.java29
-rw-r--r--JCL/converterJclMin1.8/src/java/util/Vector.java32
-rw-r--r--JCL/converterJclMin1.8/src/java/util/zip/ZipEntry.java18
-rw-r--r--JCL/converterJclMin1.8/src/java/util/zip/ZipFile.java23
-rw-r--r--JCL/converterJclMin10/.classpath6
-rw-r--r--JCL/converterJclMin10/.project17
-rw-r--r--JCL/converterJclMin10/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--JCL/converterJclMin10/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin10/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin10/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin10/src/java/lang/Error.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/Exception.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin10/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin10/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin10/src/java/lang/RuntimeException.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/String.java5
-rw-r--r--JCL/converterJclMin10/src/java/lang/Throwable.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/Documented.java7
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/ElementType.java13
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/Inherited.java7
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/Retention.java8
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin10/src/java/lang/annotation/Target.java8
-rw-r--r--JCL/converterJclMin10/src/java/lang/invoke/MethodHandle.java38
-rw-r--r--JCL/converterJclMin10/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin10/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin10/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin10/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin10/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin10/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin10/src/module-info.java7
-rw-r--r--JCL/converterJclMin11/.classpath10
-rw-r--r--JCL/converterJclMin11/.project17
-rw-r--r--JCL/converterJclMin11/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--JCL/converterJclMin11/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin11/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin11/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin11/src/java/lang/Error.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/Exception.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin11/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin11/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin11/src/java/lang/RuntimeException.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/String.java5
-rw-r--r--JCL/converterJclMin11/src/java/lang/Throwable.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/Documented.java7
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/ElementType.java13
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/Inherited.java7
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/Retention.java12
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin11/src/java/lang/annotation/Target.java12
-rw-r--r--JCL/converterJclMin11/src/java/lang/invoke/MethodHandle.java38
-rw-r--r--JCL/converterJclMin11/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin11/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin11/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin11/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin11/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin11/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin11/src/module-info.java7
-rw-r--r--JCL/converterJclMin12/.classpath10
-rw-r--r--JCL/converterJclMin12/.project17
-rw-r--r--JCL/converterJclMin12/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--JCL/converterJclMin12/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin12/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin12/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin12/src/java/lang/Error.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/Exception.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin12/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin12/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin12/src/java/lang/RuntimeException.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/String.java5
-rw-r--r--JCL/converterJclMin12/src/java/lang/Throwable.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/Documented.java7
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/ElementType.java13
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/Inherited.java7
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/Retention.java12
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin12/src/java/lang/annotation/Target.java12
-rw-r--r--JCL/converterJclMin12/src/java/lang/invoke/MethodHandle.java38
-rw-r--r--JCL/converterJclMin12/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin12/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin12/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin12/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin12/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin12/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin12/src/module-info.java7
-rw-r--r--JCL/converterJclMin13/.classpath10
-rw-r--r--JCL/converterJclMin13/.project17
-rw-r--r--JCL/converterJclMin13/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--JCL/converterJclMin13/src/META-INF/MANIFEST.MF3
-rw-r--r--JCL/converterJclMin13/src/java/io/InputStream.java5
-rw-r--r--JCL/converterJclMin13/src/java/io/PrintStream.java8
-rw-r--r--JCL/converterJclMin13/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin13/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/ClassNotFoundException.java20
-rw-r--r--JCL/converterJclMin13/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin13/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin13/src/java/lang/Error.java16
-rw-r--r--JCL/converterJclMin13/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin13/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin13/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/IncompatibleClassChangeError.java13
-rw-r--r--JCL/converterJclMin13/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/Iterable.java10
-rw-r--r--JCL/converterJclMin13/src/java/lang/LinkageError.java17
-rw-r--r--JCL/converterJclMin13/src/java/lang/NoClassDefFoundError.java13
-rw-r--r--JCL/converterJclMin13/src/java/lang/NoSuchFieldError.java13
-rw-r--r--JCL/converterJclMin13/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin13/src/java/lang/NullPointerException.java11
-rw-r--r--JCL/converterJclMin13/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin13/src/java/lang/ReflectiveOperationException.java26
-rw-r--r--JCL/converterJclMin13/src/java/lang/RuntimeException.java12
-rw-r--r--JCL/converterJclMin13/src/java/lang/String.java8
-rw-r--r--JCL/converterJclMin13/src/java/lang/System.java20
-rw-r--r--JCL/converterJclMin13/src/java/lang/Throwable.java20
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/Documented.java7
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/ElementType.java48
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/Inherited.java7
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/Retention.java12
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin13/src/java/lang/annotation/Target.java12
-rw-r--r--JCL/converterJclMin13/src/java/lang/invoke/MethodHandle.java38
-rw-r--r--JCL/converterJclMin13/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin13/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin13/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin13/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin13/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin13/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin13/src/java/util/function/Consumer.java10
-rw-r--r--JCL/converterJclMin13/src/javax/lang/model/SourceVersion.java66
-rw-r--r--JCL/converterJclMin13/src/module-info.java7
-rw-r--r--JCL/converterJclMin14/.classpath10
-rw-r--r--JCL/converterJclMin14/.project17
-rw-r--r--JCL/converterJclMin14/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--JCL/converterJclMin14/src/META-INF/MANIFEST.MF3
-rw-r--r--JCL/converterJclMin14/src/java/io/InputStream.java5
-rw-r--r--JCL/converterJclMin14/src/java/io/PrintStream.java8
-rw-r--r--JCL/converterJclMin14/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin14/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/ClassNotFoundException.java20
-rw-r--r--JCL/converterJclMin14/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin14/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin14/src/java/lang/Error.java16
-rw-r--r--JCL/converterJclMin14/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin14/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin14/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/IncompatibleClassChangeError.java13
-rw-r--r--JCL/converterJclMin14/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/Iterable.java10
-rw-r--r--JCL/converterJclMin14/src/java/lang/LinkageError.java17
-rw-r--r--JCL/converterJclMin14/src/java/lang/NoClassDefFoundError.java13
-rw-r--r--JCL/converterJclMin14/src/java/lang/NoSuchFieldError.java13
-rw-r--r--JCL/converterJclMin14/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin14/src/java/lang/NullPointerException.java11
-rw-r--r--JCL/converterJclMin14/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin14/src/java/lang/Override.java7
-rw-r--r--JCL/converterJclMin14/src/java/lang/Record.java9
-rw-r--r--JCL/converterJclMin14/src/java/lang/ReflectiveOperationException.java26
-rw-r--r--JCL/converterJclMin14/src/java/lang/RuntimeException.java12
-rw-r--r--JCL/converterJclMin14/src/java/lang/String.java8
-rw-r--r--JCL/converterJclMin14/src/java/lang/System.java20
-rw-r--r--JCL/converterJclMin14/src/java/lang/Throwable.java20
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/Documented.java7
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/ElementType.java48
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/Inherited.java7
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/Retention.java10
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin14/src/java/lang/annotation/Target.java10
-rw-r--r--JCL/converterJclMin14/src/java/lang/invoke/MethodHandle.java38
-rw-r--r--JCL/converterJclMin14/src/java/lang/invoke/MethodHandles.java21
-rw-r--r--JCL/converterJclMin14/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin14/src/java/lang/runtime/ObjectMethods.java14
-rw-r--r--JCL/converterJclMin14/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin14/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin14/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin14/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin14/src/java/util/function/Consumer.java10
-rw-r--r--JCL/converterJclMin14/src/javax/lang/model/SourceVersion.java66
-rw-r--r--JCL/converterJclMin14/src/module-info.java7
-rw-r--r--JCL/converterJclMin15/.classpath10
-rw-r--r--JCL/converterJclMin15/.project17
-rw-r--r--JCL/converterJclMin15/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--JCL/converterJclMin15/src/META-INF/MANIFEST.MF3
-rw-r--r--JCL/converterJclMin15/src/java/io/InputStream.java5
-rw-r--r--JCL/converterJclMin15/src/java/io/PrintStream.java8
-rw-r--r--JCL/converterJclMin15/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin15/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/ClassNotFoundException.java20
-rw-r--r--JCL/converterJclMin15/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin15/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin15/src/java/lang/Error.java16
-rw-r--r--JCL/converterJclMin15/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin15/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin15/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/IncompatibleClassChangeError.java13
-rw-r--r--JCL/converterJclMin15/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/Iterable.java10
-rw-r--r--JCL/converterJclMin15/src/java/lang/LinkageError.java17
-rw-r--r--JCL/converterJclMin15/src/java/lang/NoClassDefFoundError.java13
-rw-r--r--JCL/converterJclMin15/src/java/lang/NoSuchFieldError.java13
-rw-r--r--JCL/converterJclMin15/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin15/src/java/lang/NullPointerException.java11
-rw-r--r--JCL/converterJclMin15/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin15/src/java/lang/Override.java7
-rw-r--r--JCL/converterJclMin15/src/java/lang/Record.java9
-rw-r--r--JCL/converterJclMin15/src/java/lang/ReflectiveOperationException.java26
-rw-r--r--JCL/converterJclMin15/src/java/lang/RuntimeException.java12
-rw-r--r--JCL/converterJclMin15/src/java/lang/String.java8
-rw-r--r--JCL/converterJclMin15/src/java/lang/System.java20
-rw-r--r--JCL/converterJclMin15/src/java/lang/Throwable.java20
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/Documented.java12
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/ElementType.java48
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/Inherited.java13
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/Retention.java14
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin15/src/java/lang/annotation/Target.java14
-rw-r--r--JCL/converterJclMin15/src/java/lang/invoke/MethodHandle.java39
-rw-r--r--JCL/converterJclMin15/src/java/lang/invoke/MethodHandles.java22
-rw-r--r--JCL/converterJclMin15/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin15/src/java/lang/runtime/ObjectMethods.java14
-rw-r--r--JCL/converterJclMin15/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin15/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin15/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin15/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin15/src/java/util/function/Consumer.java10
-rw-r--r--JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java66
-rw-r--r--JCL/converterJclMin15/src/module-info.java7
-rw-r--r--JCL/converterJclMin9/.classpath10
-rw-r--r--JCL/converterJclMin9/.project17
-rw-r--r--JCL/converterJclMin9/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--JCL/converterJclMin9/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin9/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin9/src/java/lang/Enum.java14
-rw-r--r--JCL/converterJclMin9/src/java/lang/Error.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/Exception.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin9/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/Iterable.java6
-rw-r--r--JCL/converterJclMin9/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin9/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin9/src/java/lang/RuntimeException.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/String.java5
-rw-r--r--JCL/converterJclMin9/src/java/lang/Throwable.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/Documented.java12
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/ElementType.java13
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/Inherited.java13
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/Retention.java14
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin9/src/java/lang/annotation/Target.java14
-rw-r--r--JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java39
-rw-r--r--JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java22
-rw-r--r--JCL/converterJclMin9/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin9/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin9/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin9/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin9/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin9/src/module-info.java7
-rw-r--r--org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java4
-rw-r--r--org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/ReadAnnotationTests2.java4
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/.classpath2
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/build.properties2
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jarbin293763 -> 308315 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/lib/javax15api.jar (renamed from org.eclipse.jdt.compiler.apt.tests/lib/java14api.jar)bin118225 -> 118806 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/META-INF/services/javax.annotation.processing.Processor3
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/BaseElementProcessor.java313
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/RecordElementProcessor.java (renamed from org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java)255
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/SealedTypeElementProcessor.java301
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/MyAnnot.java2
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/Point.java5
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/module-info.java3
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/SealedExample.java9
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub/TopMain.java9
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub2/TopMain2.java7
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub3/TopMain3.java14
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java3
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/RecordElementsTests.java (renamed from org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java14ElementsTests.java)68
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/SealedTypeElementsTests.java138
-rw-r--r--org.eclipse.jdt.compiler.apt/build.properties2
-rw-r--r--org.eclipse.jdt.compiler.apt/lib/javax15api.jar (renamed from org.eclipse.jdt.compiler.tool.tests/lib/java14api.jar)bin118225 -> 118806 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java3
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java24
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java3
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java14
-rw-r--r--org.eclipse.jdt.compiler.tool.tests/.classpath2
-rw-r--r--org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.compiler.tool.tests/build.properties2
-rw-r--r--org.eclipse.jdt.compiler.tool.tests/lib/javax15api.jar (renamed from org.eclipse.jdt.compiler.tool/lib/java14api.jar)bin118225 -> 118806 bytes
-rw-r--r--org.eclipse.jdt.compiler.tool.tests/resources/module_locations/bug566749/mod.test/module-info.java2
-rw-r--r--org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolJava9Tests.java45
-rw-r--r--org.eclipse.jdt.compiler.tool/.classpath2
-rw-r--r--org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.compiler.tool/build.properties4
-rw-r--r--org.eclipse.jdt.compiler.tool/lib/javax15api.jar (renamed from org.eclipse.jdt.compiler.apt/lib/java14api.jar)bin118225 -> 118806 bytes
-rw-r--r--org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java12
-rw-r--r--org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/pom.xml36
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java47
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java24
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java1
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java74
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java8
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java5
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java105
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_15.java110
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java55
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java9
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java5
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForRecord.java12
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_15.java356
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java7
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java930
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching15Test.java (renamed from org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching14Test.java)649
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java4267
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java4
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java5308
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java26
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java299
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode13Test.java58
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java11
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java4
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java58
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java8
-rw-r--r--org.eclipse.jdt.core.tests.compiler/test.xml1
-rw-r--r--org.eclipse.jdt.core.tests.model/Build JCL Mins.launch20
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/build.xml79
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jarbin37338 -> 36444 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jarbin49646 -> 47803 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5src.zipbin49413 -> 51306 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jarbin53688 -> 51406 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7src.zipbin52783 -> 54230 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jarbin85817 -> 52456 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8src.zipbin58869 -> 55149 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jarbin15583 -> 14780 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin10src.zipbin9140 -> 9213 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jarbin15583 -> 14831 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin11src.zipbin9140 -> 9253 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jarbin15583 -> 14827 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zipbin9140 -> 9253 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jarbin23581 -> 22443 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zipbin14825 -> 14376 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jarbin24478 -> 23931 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin14src.zipbin17139 -> 15378 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jarbin0 -> 23921 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zipbin0 -> 15623 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jarbin15677 -> 15082 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin9src.zipbin11529 -> 9582 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zipbin40219 -> 42956 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.core.tests.model/pom.xml33
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava14Tests.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava14Tests.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter14Test.java619
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest_15.java1426
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_15Test.java1126
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java27
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java6
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java7
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java56
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java77
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests14.java8
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests14.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests15.java218
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java14
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs14Tests.java1086
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs15Tests.java1955
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java9
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java9
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java82
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RecordsElementTests.java244
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SealedTypeModelTests.java391
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInstanceOfPatternExpressionTest.java14
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordAnnotationsTest.java1130
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordDeclarationTest.java189
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java13
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java7
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java519
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewrite_15Test.java (renamed from org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewrite14Test.java)25
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15/.classpath6
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15/.project17
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15/src/X.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.classpath6
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.project17
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/javadoc/test0001/X.java7
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/module-info.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/.classpath6
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_jar.jarbin0 -> 1860 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_source_jar.jarbin0 -> 2146 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_nonsource_jar.jarbin0 -> 1501 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_source_jar.jarbin0 -> 1895 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_nonsource_jar.jarbin0 -> 1792 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_source_jar.jarbin0 -> 2129 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/test_automodules/bin/test_automodules/Test.classbin0 -> 340 bytes
-rw-r--r--org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/SecondaryTypesPerformanceTest.java4
-rw-r--r--org.eclipse.jdt.core/.settings/.api_filters185
-rw-r--r--org.eclipse.jdt.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java13
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java4
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties9
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java7
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java9
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java139
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/RestrictedIdentifiers.java7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java93
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java14
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java293
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java14
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java26
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java17
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompactConstructorDeclaration.java84
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java19
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java50
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java22
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java41
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java52
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java73
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocModuleReference.java124
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java38
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java19
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java23
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java67
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java47
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java43
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java15
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java23
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java53
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java13
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/RecordComponentInfo.java (renamed from org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfo.java)31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java25
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IComponent.java54
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IRecordComponent.java18
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java13
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java91
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java65
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java1
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java22
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java202
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtendedTagBits.java1
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java20
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java346
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java94
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java70
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java1217
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java28
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java363
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java132
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java191
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rscbin36162 -> 35878 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rscbin626 -> 626 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rscbin626 -> 626 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rscbin2446 -> 2446 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rscbin1590 -> 1598 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rscbin2396 -> 2416 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rscbin908 -> 919 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rscbin16226 -> 16876 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rscbin626 -> 626 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rscbin34346 -> 34040 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rscbin17806 -> 18318 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rscbin7264 -> 7352 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rscbin838 -> 848 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rscbin100 -> 100 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rscbin838 -> 848 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rscbin2396 -> 2416 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rscbin3548 -> 3804 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rscbin2396 -> 2416 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rscbin1578 -> 1586 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rscbin266 -> 272 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rscbin838 -> 848 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rscbin16042 -> 16848 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part0.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part1.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part14.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part2.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part3.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start0.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start1.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start2.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start3.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java437
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties42
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java6
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java51
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java74
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java31
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java43
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java30
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java15
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java98
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMethodBinding.java13
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java13
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java8
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java4
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java78
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java252
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java8
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java10
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java42
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java140
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java4
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java42
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java22
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java18
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java56
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java11
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java6
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java9
-rw-r--r--org.eclipse.jdt.core/grammar/java.g40
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java44
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java28
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java8
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttribute.java41
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttributeEntry.java39
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java22
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java130
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java82
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java8
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryRecordComponent.java143
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java25
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java31
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java42
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java6
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java9
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java18
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java18
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java18
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java13
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java35
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java1
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttribute.java67
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttributeEntry.java55
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java1
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties3
-rw-r--r--org.eclipse.jdt.core/pom.xml2
-rw-r--r--org.eclipse.jdt.core/scripts/GenerateParserScript.java1
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java14
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java3
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java13
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java8
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java5
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java23
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java35
-rw-r--r--org.eclipse.jdt.tests.latestBREE/.classpath2
-rw-r--r--org.eclipse.jdt.tests.latestBREE/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.jdt.tests.latestBREE/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.tests.latestBREE/pom.xml30
-rw-r--r--org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/compiler/regression/latest/TextBlockTest.java1
-rw-r--r--org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/model/CompletionTests13.java1
1045 files changed, 39070 insertions, 4384 deletions
diff --git a/JCL/.gitignore b/JCL/.gitignore
new file mode 100644
index 0000000000..9d41eb50ea
--- /dev/null
+++ b/JCL/.gitignore
@@ -0,0 +1 @@
+*/bin/
diff --git a/JCL/converterJclMin/.classpath b/JCL/converterJclMin/.classpath
new file mode 100644
index 0000000000..6ab8f66c5b
--- /dev/null
+++ b/JCL/converterJclMin/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin/.project b/JCL/converterJclMin/.project
new file mode 100644
index 0000000000..df6b4719b6
--- /dev/null
+++ b/JCL/converterJclMin/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..cd734f4167
--- /dev/null
+++ b/JCL/converterJclMin/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/JCL/converterJclMin/src/java/awt/List.java b/JCL/converterJclMin/src/java/awt/List.java
new file mode 100644
index 0000000000..b2fd6f7c24
--- /dev/null
+++ b/JCL/converterJclMin/src/java/awt/List.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.awt;
+
+public class List {
+
+}
diff --git a/JCL/converterJclMin/src/java/awt/Point.java b/JCL/converterJclMin/src/java/awt/Point.java
new file mode 100644
index 0000000000..132f09602b
--- /dev/null
+++ b/JCL/converterJclMin/src/java/awt/Point.java
@@ -0,0 +1,7 @@
+package java.awt;
+
+public class Point {
+
+ public int x;
+ public int y;
+}
diff --git a/JCL/converterJclMin/src/java/io/BufferedInputStream.java b/JCL/converterJclMin/src/java/io/BufferedInputStream.java
new file mode 100644
index 0000000000..aa574a1930
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/BufferedInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedInputStream extends InputStream {
+ public BufferedInputStream(InputStream inputStream) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/BufferedOutputStream.java b/JCL/converterJclMin/src/java/io/BufferedOutputStream.java
new file mode 100644
index 0000000000..3ab0e26fc5
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/BufferedOutputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedOutputStream extends OutputStream {
+ public BufferedOutputStream(FileOutputStream outputStream) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/BufferedWriter.java b/JCL/converterJclMin/src/java/io/BufferedWriter.java
new file mode 100644
index 0000000000..61122c1b2f
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/BufferedWriter.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedWriter extends Writer {
+
+ public BufferedWriter(Writer writer) {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/ByteArrayInputStream.java b/JCL/converterJclMin/src/java/io/ByteArrayInputStream.java
new file mode 100644
index 0000000000..7f095dcbcb
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/ByteArrayInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayInputStream extends InputStream {
+ public ByteArrayInputStream(byte[] b) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/ByteArrayOutputStream.java b/JCL/converterJclMin/src/java/io/ByteArrayOutputStream.java
new file mode 100644
index 0000000000..8af40644cc
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/ByteArrayOutputStream.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayOutputStream extends OutputStream {
+
+}
diff --git a/JCL/converterJclMin/src/java/io/File.java b/JCL/converterJclMin/src/java/io/File.java
new file mode 100644
index 0000000000..e0465e47fa
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/File.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class File {
+ public static final char separatorChar = '\\';
+ public static final String separator = "\\"; //$NON-NLS-1$
+
+ public File(String s) {
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean isDirectory() {
+ return false;
+ }
+
+ public String getAbsolutePath() {
+ return null;
+ }
+
+ public boolean mkdirs() {
+ return false;
+ }
+
+ public boolean mkdir() {
+ return false;
+ }
+
+ public String getName() {
+ return null;
+ }
+ public long length() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/FileInputStream.java b/JCL/converterJclMin/src/java/io/FileInputStream.java
new file mode 100644
index 0000000000..c51d1be33c
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/FileInputStream.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileInputStream extends InputStream {
+
+ public FileInputStream(File f) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/FileOutputStream.java b/JCL/converterJclMin/src/java/io/FileOutputStream.java
new file mode 100644
index 0000000000..c643bf9c41
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/FileOutputStream.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileOutputStream extends OutputStream {
+ public FileOutputStream(File f) {
+ }
+ public FileOutputStream(String s) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/FileWriter.java b/JCL/converterJclMin/src/java/io/FileWriter.java
new file mode 100644
index 0000000000..667a188869
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/FileWriter.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileWriter extends Writer {
+
+ public FileWriter(String s) {
+ }
+ public void flush() throws IOException {
+ }
+
+ public void close() throws IOException {
+ }
+
+}
diff --git a/JCL/converterJclMin/src/java/io/IOException.java b/JCL/converterJclMin/src/java/io/IOException.java
new file mode 100644
index 0000000000..a73f64275e
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/IOException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class IOException extends Exception {
+
+ public IOException(String s) {
+ super(s);
+ }
+ public IOException() {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/InputStream.java b/JCL/converterJclMin/src/java/io/InputStream.java
new file mode 100644
index 0000000000..8aa222e902
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/InputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InputStream {
+ public void close() throws IOException {
+ }
+ public int available() throws IOException {
+ return 0;
+ }
+ public int read(byte b[], int off, int len) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/InputStreamReader.java b/JCL/converterJclMin/src/java/io/InputStreamReader.java
new file mode 100644
index 0000000000..a9012a34b8
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/InputStreamReader.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class InputStreamReader extends Reader {
+ public InputStreamReader(InputStream inputStream) {
+ }
+ public InputStreamReader(InputStream stream, String s) throws UnsupportedEncodingException {
+ }
+ public int read(char cbuf[], int offset, int length) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/InterruptedIOException.java b/JCL/converterJclMin/src/java/io/InterruptedIOException.java
new file mode 100644
index 0000000000..c95111adfc
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/InterruptedIOException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InterruptedIOException extends Exception {
+
+}
diff --git a/JCL/converterJclMin/src/java/io/OutputStream.java b/JCL/converterJclMin/src/java/io/OutputStream.java
new file mode 100644
index 0000000000..8d9756265b
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/OutputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class OutputStream {
+
+ public void write(byte b[]) throws IOException {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/PrintStream.java b/JCL/converterJclMin/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..503f080425
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/PrintStream.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintStream {
+
+ public void println() {
+ }
+
+ public void println(String s) {
+ }
+
+ public void println(int i) {
+ }
+
+ public void println(Object o) {
+ }
+
+ public void print(String s) {
+ }
+
+ public void print(Object o) {
+ }
+
+ public void print(int i) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/PrintWriter.java b/JCL/converterJclMin/src/java/io/PrintWriter.java
new file mode 100644
index 0000000000..ec7e885e07
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/PrintWriter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintWriter extends Writer {
+ public PrintWriter(ByteArrayOutputStream stream) {
+ }
+ public PrintWriter(Writer w) {
+ }
+ public void print(String s) {
+ }
+ public void print(char[] tab) {
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+ public void println(String s) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/Reader.java b/JCL/converterJclMin/src/java/io/Reader.java
new file mode 100644
index 0000000000..bb74ec22fa
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/Reader.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class Reader {
+
+}
diff --git a/JCL/converterJclMin/src/java/io/Serializable.java b/JCL/converterJclMin/src/java/io/Serializable.java
new file mode 100644
index 0000000000..e33731bec8
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/Serializable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public interface Serializable {
+
+}
diff --git a/JCL/converterJclMin/src/java/io/StringWriter.java b/JCL/converterJclMin/src/java/io/StringWriter.java
new file mode 100644
index 0000000000..84631fdee0
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/StringWriter.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class StringWriter extends Writer {
+
+ public StringBuffer getBuffer() {
+ return null;
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/UnsupportedEncodingException.java b/JCL/converterJclMin/src/java/io/UnsupportedEncodingException.java
new file mode 100644
index 0000000000..916b5ccdcd
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/UnsupportedEncodingException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class UnsupportedEncodingException extends IOException {
+ public UnsupportedEncodingException(String s) {
+ super(s);
+ }
+ public UnsupportedEncodingException() {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/io/Writer.java b/JCL/converterJclMin/src/java/io/Writer.java
new file mode 100644
index 0000000000..8a198ae50c
--- /dev/null
+++ b/JCL/converterJclMin/src/java/io/Writer.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public abstract class Writer {
+ public abstract void flush() throws IOException;
+ public abstract void close() throws IOException;
+ public void write(String str) throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/ArithmeticException.java b/JCL/converterJclMin/src/java/lang/ArithmeticException.java
new file mode 100644
index 0000000000..063baae8d8
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ArithmeticException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArithmeticException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/ArrayIndexOutOfBoundsException.java b/JCL/converterJclMin/src/java/lang/ArrayIndexOutOfBoundsException.java
new file mode 100644
index 0000000000..af436866fe
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ArrayIndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/AssertionError.java b/JCL/converterJclMin/src/java/lang/AssertionError.java
new file mode 100644
index 0000000000..73b789252c
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/AssertionError.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class AssertionError extends Error {
+
+ /**
+ * Constructor for AssertionError.
+ * @param s
+ */
+ public AssertionError(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for AssertionError.
+ */
+ public AssertionError() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/Boolean.java b/JCL/converterJclMin/src/java/lang/Boolean.java
new file mode 100644
index 0000000000..198c9287b1
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Boolean.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Boolean {
+ public static final Boolean TRUE = new Boolean(true);
+ public static final Boolean FALSE = new Boolean(false);
+ public Boolean(boolean b) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Byte.java b/JCL/converterJclMin/src/java/lang/Byte.java
new file mode 100644
index 0000000000..57fe180246
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Byte.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Byte extends Number {
+ public Byte(byte b) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Character.java b/JCL/converterJclMin/src/java/lang/Character.java
new file mode 100644
index 0000000000..337c148689
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Character.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Character {
+ public Character(char c) {
+ }
+ public static char toLowerCase(char c) {
+ return ' ';
+ }
+
+ public static int getNumericValue(char c) {
+ return 0;
+ }
+
+ public static int digit(char ch, int radix) {
+ return 0;
+ }
+ public static boolean isWhitespace(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierStart(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierPart(char c) {
+ return false;
+ }
+ public static boolean isDigit(char c) {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Class.java b/JCL/converterJclMin/src/java/lang/Class.java
new file mode 100644
index 0000000000..bfa8272d7d
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Class.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.InputStream;
+
+public class Class {
+ public String getName() {
+ return null;
+ }
+ public InputStream getResourceAsStream(String s) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/ClassCastException.java b/JCL/converterJclMin/src/java/lang/ClassCastException.java
new file mode 100644
index 0000000000..51bbbd2125
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ClassCastException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ClassCastException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..79875fa4a9
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2020 GK Software SE and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+public class ClassNotFoundException extends ReflectiveOperationException {
+ public ClassNotFoundException() { super(); }
+ public ClassNotFoundException(String s) { super(s); }
+ public ClassNotFoundException(String s, Throwable t) { super(s, t);}
+ public Throwable getException() { return null; }
+}
diff --git a/JCL/converterJclMin/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..2074efbf9e
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin/src/java/lang/Cloneable.java b/JCL/converterJclMin/src/java/lang/Cloneable.java
new file mode 100644
index 0000000000..bc1cb76200
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Cloneable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Cloneable {
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/Comparable.java b/JCL/converterJclMin/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..09be762d0f
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Comparable.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public interface Comparable {
+ public int compareTo(Object o);
+}
diff --git a/JCL/converterJclMin/src/java/lang/Double.java b/JCL/converterJclMin/src/java/lang/Double.java
new file mode 100644
index 0000000000..fee7129f89
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Double.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Double extends Number {
+ public Double(double d) {
+ }
+ public static String toString(double d) {
+ return null;
+ }
+ public static Double valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final double POSITIVE_INFINITY = 1.0 / 0.0;
+ public static boolean isNaN(double v) {
+ return false;
+ }
+ public double doubleValue() {
+ return 0.0;
+ }
+ public static final double MAX_VALUE = 1.7976931348623157e+308;
+ public static final double MIN_VALUE = 4.9e-324;
+ public static final double NaN = 0.0d / 0.0;
+
+ public static native double longBitsToDouble(long bits);
+ public static native long doubleToLongBits(double value);
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public static double parseDouble(String s) {
+ return 0.0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Error.java b/JCL/converterJclMin/src/java/lang/Error.java
new file mode 100644
index 0000000000..fc4766d731
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Error.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(String s) {
+ super(s);
+ }
+
+ public Error() {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Exception.java b/JCL/converterJclMin/src/java/lang/Exception.java
new file mode 100644
index 0000000000..f7969390d9
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ }
+ public Exception(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/ExceptionInInitializerError.java b/JCL/converterJclMin/src/java/lang/ExceptionInInitializerError.java
new file mode 100644
index 0000000000..907abda50d
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ExceptionInInitializerError.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ExceptionInInitializerError extends Error {
+ public ExceptionInInitializerError(String s) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Float.java b/JCL/converterJclMin/src/java/lang/Float.java
new file mode 100644
index 0000000000..ff66ee6f1f
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Float.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Float extends Number {
+ public static final float NaN = 0.0f / 0.0f;
+ public Float(float f) {
+ }
+ public static native float intBitsToFloat(int bits);
+ public static Float valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final float POSITIVE_INFINITY = 1.0f / 0.0f;
+ public static boolean isNaN(float v) {
+ return false;
+ }
+ public float floatValue() {
+ return 0.0f;
+ }
+ public static final float MAX_VALUE = 3.4028235e+38f;
+ public static final float MIN_VALUE = 1.4e-45f;
+ public static native int floatToIntBits(float value);
+ public static String toString(float f) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..0e7fb8025f
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+ public IllegalMonitorStateException(String s) {
+ }
+ public IllegalMonitorStateException() {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/IndexOutOfBoundsException.java b/JCL/converterJclMin/src/java/lang/IndexOutOfBoundsException.java
new file mode 100644
index 0000000000..7230956f64
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/IndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class IndexOutOfBoundsException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/Integer.java b/JCL/converterJclMin/src/java/lang/Integer.java
new file mode 100644
index 0000000000..8d2027efa8
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Integer.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Integer extends Number {
+ public Integer(int i) {
+ }
+ public Integer(String s) {
+ }
+ public static final int MAX_VALUE= 2147483647;
+ public static final int MIN_VALUE= -2147483647;
+
+ public static int parseInt(String s) throws NumberFormatException {
+ return 0;
+ }
+ public static String toHexString(int i) {
+ return null;
+ }
+ public static String toString(int i) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/InterruptedException.java b/JCL/converterJclMin/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..8bbd866439
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/InterruptedException.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin/src/java/lang/Long.java b/JCL/converterJclMin/src/java/lang/Long.java
new file mode 100644
index 0000000000..094fde461c
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Long.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Long extends Number {
+ public static final long MIN_VALUE = 0x8000000000000000L;
+ public static final long MAX_VALUE = 0x7fffffffffffffffL;
+ public Long(long l) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Math.java b/JCL/converterJclMin/src/java/lang/Math.java
new file mode 100644
index 0000000000..5183719463
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Math.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Math {
+
+ public static int min(int a, int b) {
+ return 0;
+ }
+ public static int max(int a, int b) {
+ return 0;
+ }
+ public static int abs(int a) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 0000000000..b6eefdc89e
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2020 GK Software SE and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package java.lang;
+public class NoSuchFieldError extends IncompatibleClassChangeError {
+ public NoSuchFieldError() { super(); }
+ public NoSuchFieldError(String s) {super(s);}
+}
diff --git a/JCL/converterJclMin/src/java/lang/NullPointerException.java b/JCL/converterJclMin/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..6a76c3c57a
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/NullPointerException.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class NullPointerException extends RuntimeException {
+
+ /**
+ * Constructor for NullPointerException.
+ * @param s
+ */
+ public NullPointerException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for NullPointerException.
+ */
+ public NullPointerException() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/Number.java b/JCL/converterJclMin/src/java/lang/Number.java
new file mode 100644
index 0000000000..602872f458
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Number.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public abstract class Number {
+ public abstract int intValue();
+ public abstract long longValue();
+ public abstract float floatValue();
+ public abstract double doubleValue();
+ public byte byteValue() {
+ return (byte) intValue();
+ }
+ public short shortValue() {
+ return (short) intValue();
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/NumberFormatException.java b/JCL/converterJclMin/src/java/lang/NumberFormatException.java
new file mode 100644
index 0000000000..db1be617e0
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/NumberFormatException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class NumberFormatException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin/src/java/lang/Object.java b/JCL/converterJclMin/src/java/lang/Object.java
new file mode 100644
index 0000000000..7a501924c7
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Object.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Object {
+
+ public Object() {
+ }
+ protected Object clone() throws CloneNotSupportedException {
+ return null;
+ }
+ public boolean equals(Object obj) {
+ return false;
+ }
+ protected void finalize() throws Throwable {
+ }
+ public final Class getClass() {
+ return null;
+ }
+ public int hashCode() {
+ return -1;
+ }
+ public final void notify() throws IllegalMonitorStateException {
+ }
+ public final void notifyAll() throws IllegalMonitorStateException {
+ }
+ public String toString() {
+ return null;
+ }
+ public final void wait() throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis) throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis, int nanos)
+ throws IllegalMonitorStateException, InterruptedException {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 0000000000..cdbe130edd
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2020 GK Software SE and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ public ReflectiveOperationException() {
+ super();
+ }
+ public ReflectiveOperationException(String s, Throwable t) {
+ this(s);
+ }
+ public ReflectiveOperationException(java.lang.String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Runnable.java b/JCL/converterJclMin/src/java/lang/Runnable.java
new file mode 100644
index 0000000000..d37f3130d1
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Runnable.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Runnable {
+
+ void run();
+}
diff --git a/JCL/converterJclMin/src/java/lang/RuntimeException.java b/JCL/converterJclMin/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..be85127b2e
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/RuntimeException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class RuntimeException extends Exception {
+ public RuntimeException(String s) {
+ super(s);
+ }
+ public RuntimeException() {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Short.java b/JCL/converterJclMin/src/java/lang/Short.java
new file mode 100644
index 0000000000..e61f1368ad
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Short.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Short extends Number {
+ public Short(short s) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/String.java b/JCL/converterJclMin/src/java/lang/String.java
new file mode 100644
index 0000000000..219e3a0c5a
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/String.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class String {
+ public String() {
+ }
+ public String(char[] source) {
+ }
+ public String(String s) {
+ }
+ public String(char[] source, int i , int j) {
+ }
+ public int length() {
+ return 0;
+ }
+ public String replace(char oldChar, char newChar) {
+ return null;
+ }
+
+ public int lastIndexOf(char c) {
+ return 0;
+ }
+
+ public String substring(int i, int j) {
+ return null;
+ }
+ public String substring(int i) {
+ return null;
+ }
+ public char[] toCharArray() {
+ return null;
+ }
+ public int indexOf(String s) {
+ return 0;
+ }
+ public int indexOf(String s, int i) {
+ return 0;
+ }
+ public boolean endsWith(String s) {
+ return false;
+ }
+ public static String valueOf(int i) {
+ return null;
+ }
+ public static String valueOf(Object o) {
+ return null;
+ }
+ public static String valueOf(char[] tab) {
+ return null;
+ }
+ public static String valueOf(char[] tab, int i, int j) {
+ return null;
+ }
+ public int compareTo(String s) {
+ return 0;
+ }
+ public int indexOf(int ch, int fromIndex) {
+ return 0;
+ }
+ public char charAt(int i) {
+ return ' ';
+ }
+ public String trim() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/StringBuffer.java b/JCL/converterJclMin/src/java/lang/StringBuffer.java
new file mode 100644
index 0000000000..f77dd695b0
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/StringBuffer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class StringBuffer {
+ public StringBuffer() {
+ }
+ public StringBuffer(String s) {
+ }
+ public StringBuffer(int i) {
+ }
+ public synchronized StringBuffer insert(int offset, String str) {
+ return this;
+ }
+ public synchronized StringBuffer append(String s) {
+ return this;
+ }
+ public synchronized StringBuffer append(StringBuffer buffer) {
+ return this;
+ }
+ public synchronized StringBuffer append(boolean b) {
+ return this;
+ }
+ public synchronized StringBuffer append(int i) {
+ return this;
+ }
+ public synchronized StringBuffer append(long l) {
+ return this;
+ }
+ public synchronized StringBuffer append(float f) {
+ return this;
+ }
+ public synchronized StringBuffer append(double d) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o, int i, int j) {
+ return this;
+ }
+ public synchronized StringBuffer append(Object o) {
+ return this;
+ }
+ public int length() {
+ return 0;
+ }
+ public char[] getChars(int i, int j, char[] tab, int k) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/System.java b/JCL/converterJclMin/src/java/lang/System.java
new file mode 100644
index 0000000000..a13acd2404
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/System.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+
+public class System {
+
+ public static PrintStream err;
+ public static PrintStream out;
+
+ public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
+ public static String getProperty(String s) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Throwable.java b/JCL/converterJclMin/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..42ebfd75a1
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Throwable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+import java.io.Writer;
+
+public class Throwable {
+ public Throwable(String s) {
+ }
+ public Throwable() {
+ }
+
+ public void printStackTrace() {
+ }
+
+ public void printStackTrace(Writer w) {
+ }
+
+ public void printStackTrace(PrintStream w) {
+ }
+ public String getMessage() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/Void.java b/JCL/converterJclMin/src/java/lang/Void.java
new file mode 100644
index 0000000000..72e9ca2bec
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/Void.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Void {} \ No newline at end of file
diff --git a/JCL/converterJclMin/src/java/lang/ref/Reference.java b/JCL/converterJclMin/src/java/lang/ref/Reference.java
new file mode 100644
index 0000000000..4d163a8bd1
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ref/Reference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class Reference {
+ public Object get() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/ref/ReferenceQueue.java b/JCL/converterJclMin/src/java/lang/ref/ReferenceQueue.java
new file mode 100644
index 0000000000..9fe70bdafe
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ref/ReferenceQueue.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class ReferenceQueue {
+ public Reference poll() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/lang/ref/WeakReference.java b/JCL/converterJclMin/src/java/lang/ref/WeakReference.java
new file mode 100644
index 0000000000..a45438ab53
--- /dev/null
+++ b/JCL/converterJclMin/src/java/lang/ref/WeakReference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+
+public class WeakReference extends Reference {
+ public WeakReference(Object o, ReferenceQueue queue) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/net/MalformedURLException.java b/JCL/converterJclMin/src/java/net/MalformedURLException.java
new file mode 100644
index 0000000000..887f4a7c4b
--- /dev/null
+++ b/JCL/converterJclMin/src/java/net/MalformedURLException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.net;
+
+public class MalformedURLException extends Exception {
+
+}
diff --git a/JCL/converterJclMin/src/java/text/NumberFormat.java b/JCL/converterJclMin/src/java/text/NumberFormat.java
new file mode 100644
index 0000000000..93a29b63cf
--- /dev/null
+++ b/JCL/converterJclMin/src/java/text/NumberFormat.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.text;
+
+public class NumberFormat {
+
+ public final static NumberFormat getInstance() {
+ return null;
+ }
+
+ public final String format (double d) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/ArrayList.java b/JCL/converterJclMin/src/java/util/ArrayList.java
new file mode 100644
index 0000000000..7e5e8b271f
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/ArrayList.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class ArrayList implements List {
+
+ public ArrayList(int i) {
+ }
+ public ArrayList() {
+ }
+ public Object[] toArray(Object[] o) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public boolean add(Object o) {
+ return false;
+ }
+ public int indexOf(Object o) {
+ return 0;
+ }
+ public Object remove(int index) {
+ return null;
+ }
+ public Object get(int index) {
+ return null;
+ }
+ public boolean contains(Object o) {
+ return false;
+ }
+ public Iterator iterator() {
+ return null;
+ }
+ public boolean addAll(Collection c) {
+ return false;
+ }
+ public void set(int i, Object o) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Arrays.java b/JCL/converterJclMin/src/java/util/Arrays.java
new file mode 100644
index 0000000000..a28dfe05b0
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Arrays.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class Arrays {
+ public static void sort(Object[] tab) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Collection.java b/JCL/converterJclMin/src/java/util/Collection.java
new file mode 100644
index 0000000000..e9e15fa085
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Collection.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Collection {
+ public Iterator iterator();
+ public int size();
+ public Object get(int index);
+ public boolean addAll(Collection c);
+ public Object[] toArray(Object[] o);
+}
diff --git a/JCL/converterJclMin/src/java/util/Collections.java b/JCL/converterJclMin/src/java/util/Collections.java
new file mode 100644
index 0000000000..cb82830e3c
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Collections.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class Collections {
+ public static void sort(List l) {
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Enumeration.java b/JCL/converterJclMin/src/java/util/Enumeration.java
new file mode 100644
index 0000000000..71ce4fb586
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Enumeration.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Enumeration {
+
+ public boolean hasMoreElements();
+
+ public Object nextElement();
+}
diff --git a/JCL/converterJclMin/src/java/util/HashMap.java b/JCL/converterJclMin/src/java/util/HashMap.java
new file mode 100644
index 0000000000..543d56694d
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/HashMap.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class HashMap implements Map {
+ public HashMap(int i) {
+ }
+ public Object get(Object o) {
+ return null;
+ }
+ public boolean containsKey(Object o) {
+ return false;
+ }
+ public void put(Object o, Object v) {
+ }
+ public int size() {
+ return 0;
+ }
+ public Set keySet() {
+ return null;
+ }
+ public Collection values() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Hashtable.java b/JCL/converterJclMin/src/java/util/Hashtable.java
new file mode 100644
index 0000000000..ca5ad6c4d9
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Hashtable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Hashtable implements Map {
+ public Hashtable(int i) {
+ }
+ public Object get(Object o) {
+ return null;
+ }
+ public boolean containsKey(Object o) {
+ return false;
+ }
+ public void put(Object o, Object v) {
+ }
+ public synchronized Enumeration elements() {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public synchronized Enumeration keys() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Iterator.java b/JCL/converterJclMin/src/java/util/Iterator.java
new file mode 100644
index 0000000000..7d06d85047
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Iterator.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public interface Iterator {
+ public boolean hasNext();
+ public Object next();
+}
diff --git a/JCL/converterJclMin/src/java/util/List.java b/JCL/converterJclMin/src/java/util/List.java
new file mode 100644
index 0000000000..467cb7badb
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/List.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface List extends Collection {
+ public boolean add(Object o);
+ public void set(int i, Object o);
+}
diff --git a/JCL/converterJclMin/src/java/util/Locale.java b/JCL/converterJclMin/src/java/util/Locale.java
new file mode 100644
index 0000000000..d591b3946a
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Locale.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Locale {
+ public static Locale getDefault() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Map.java b/JCL/converterJclMin/src/java/util/Map.java
new file mode 100644
index 0000000000..c0ba203e8f
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Map.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Map {
+
+ public Object get(Object o);
+ public boolean containsKey(Object o);
+ public void put(Object o, Object v);
+}
diff --git a/JCL/converterJclMin/src/java/util/MissingResourceException.java b/JCL/converterJclMin/src/java/util/MissingResourceException.java
new file mode 100644
index 0000000000..f5f7c87e82
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/MissingResourceException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class MissingResourceException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin/src/java/util/NoSuchElementException.java b/JCL/converterJclMin/src/java/util/NoSuchElementException.java
new file mode 100644
index 0000000000..a049d80d09
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/NoSuchElementException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class NoSuchElementException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin/src/java/util/ResourceBundle.java b/JCL/converterJclMin/src/java/util/ResourceBundle.java
new file mode 100644
index 0000000000..027b99f365
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/ResourceBundle.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public abstract class ResourceBundle {
+
+ public static final ResourceBundle getBundle(String baseName, Locale locale) {
+ return null;
+ }
+
+ public final String getString(String key) {
+ return null;
+ }
+ public abstract Enumeration getKeys();
+}
diff --git a/JCL/converterJclMin/src/java/util/Set.java b/JCL/converterJclMin/src/java/util/Set.java
new file mode 100644
index 0000000000..ad017a2da2
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Set.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class Set {
+ public Iterator iterator() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/StringTokenizer.java b/JCL/converterJclMin/src/java/util/StringTokenizer.java
new file mode 100644
index 0000000000..86214d8596
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/StringTokenizer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class StringTokenizer {
+
+ public StringTokenizer(String toBeParsed, String delimiters) {
+ }
+
+ public int countTokens() {
+ return 0;
+ }
+
+ public String nextToken() {
+ return null;
+ }
+
+ public boolean hasMoreTokens() {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/Vector.java b/JCL/converterJclMin/src/java/util/Vector.java
new file mode 100644
index 0000000000..e26e51f781
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/Vector.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Vector {
+
+ public Vector() {
+ }
+
+ public Vector(int i) {
+ }
+
+ public int size() {
+ return 0;
+ }
+
+ public Object get(int i) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/zip/ZipEntry.java b/JCL/converterJclMin/src/java/util/zip/ZipEntry.java
new file mode 100644
index 0000000000..7c82b06d8c
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/zip/ZipEntry.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+
+public class ZipEntry {
+ public long getSize() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin/src/java/util/zip/ZipFile.java b/JCL/converterJclMin/src/java/util/zip/ZipFile.java
new file mode 100644
index 0000000000..56c853a2bc
--- /dev/null
+++ b/JCL/converterJclMin/src/java/util/zip/ZipFile.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+import java.io.InputStream;
+
+
+public class ZipFile {
+ public ZipEntry getEntry(String s) {
+ return null;
+ }
+ public InputStream getInputStream(ZipEntry zipEntry) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/.classpath b/JCL/converterJclMin1.5/.classpath
new file mode 100644
index 0000000000..fb8a2f0102
--- /dev/null
+++ b/JCL/converterJclMin1.5/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin1.5/.project b/JCL/converterJclMin1.5/.project
new file mode 100644
index 0000000000..058d2e0ee3
--- /dev/null
+++ b/JCL/converterJclMin1.5/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin1.5</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin1.5/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin1.5/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..272e3b91d2
--- /dev/null
+++ b/JCL/converterJclMin1.5/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/JCL/converterJclMin1.5/src/java/awt/List.java b/JCL/converterJclMin1.5/src/java/awt/List.java
new file mode 100644
index 0000000000..b2fd6f7c24
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/awt/List.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.awt;
+
+public class List {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/BufferedInputStream.java b/JCL/converterJclMin1.5/src/java/io/BufferedInputStream.java
new file mode 100644
index 0000000000..aa574a1930
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/BufferedInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedInputStream extends InputStream {
+ public BufferedInputStream(InputStream inputStream) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/BufferedOutputStream.java b/JCL/converterJclMin1.5/src/java/io/BufferedOutputStream.java
new file mode 100644
index 0000000000..3ab0e26fc5
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/BufferedOutputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedOutputStream extends OutputStream {
+ public BufferedOutputStream(FileOutputStream outputStream) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/BufferedWriter.java b/JCL/converterJclMin1.5/src/java/io/BufferedWriter.java
new file mode 100644
index 0000000000..61122c1b2f
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/BufferedWriter.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedWriter extends Writer {
+
+ public BufferedWriter(Writer writer) {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/ByteArrayInputStream.java b/JCL/converterJclMin1.5/src/java/io/ByteArrayInputStream.java
new file mode 100644
index 0000000000..7f095dcbcb
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/ByteArrayInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayInputStream extends InputStream {
+ public ByteArrayInputStream(byte[] b) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/ByteArrayOutputStream.java b/JCL/converterJclMin1.5/src/java/io/ByteArrayOutputStream.java
new file mode 100644
index 0000000000..8af40644cc
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/ByteArrayOutputStream.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayOutputStream extends OutputStream {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/File.java b/JCL/converterJclMin1.5/src/java/io/File.java
new file mode 100644
index 0000000000..e0465e47fa
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/File.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class File {
+ public static final char separatorChar = '\\';
+ public static final String separator = "\\"; //$NON-NLS-1$
+
+ public File(String s) {
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean isDirectory() {
+ return false;
+ }
+
+ public String getAbsolutePath() {
+ return null;
+ }
+
+ public boolean mkdirs() {
+ return false;
+ }
+
+ public boolean mkdir() {
+ return false;
+ }
+
+ public String getName() {
+ return null;
+ }
+ public long length() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/FileInputStream.java b/JCL/converterJclMin1.5/src/java/io/FileInputStream.java
new file mode 100644
index 0000000000..c51d1be33c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/FileInputStream.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileInputStream extends InputStream {
+
+ public FileInputStream(File f) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/FileOutputStream.java b/JCL/converterJclMin1.5/src/java/io/FileOutputStream.java
new file mode 100644
index 0000000000..c643bf9c41
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/FileOutputStream.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileOutputStream extends OutputStream {
+ public FileOutputStream(File f) {
+ }
+ public FileOutputStream(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/FileWriter.java b/JCL/converterJclMin1.5/src/java/io/FileWriter.java
new file mode 100644
index 0000000000..667a188869
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/FileWriter.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileWriter extends Writer {
+
+ public FileWriter(String s) {
+ }
+ public void flush() throws IOException {
+ }
+
+ public void close() throws IOException {
+ }
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/IOException.java b/JCL/converterJclMin1.5/src/java/io/IOException.java
new file mode 100644
index 0000000000..a73f64275e
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/IOException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class IOException extends Exception {
+
+ public IOException(String s) {
+ super(s);
+ }
+ public IOException() {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/InputStream.java b/JCL/converterJclMin1.5/src/java/io/InputStream.java
new file mode 100644
index 0000000000..8aa222e902
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/InputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InputStream {
+ public void close() throws IOException {
+ }
+ public int available() throws IOException {
+ return 0;
+ }
+ public int read(byte b[], int off, int len) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/InputStreamReader.java b/JCL/converterJclMin1.5/src/java/io/InputStreamReader.java
new file mode 100644
index 0000000000..a9012a34b8
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/InputStreamReader.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class InputStreamReader extends Reader {
+ public InputStreamReader(InputStream inputStream) {
+ }
+ public InputStreamReader(InputStream stream, String s) throws UnsupportedEncodingException {
+ }
+ public int read(char cbuf[], int offset, int length) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/InterruptedIOException.java b/JCL/converterJclMin1.5/src/java/io/InterruptedIOException.java
new file mode 100644
index 0000000000..c95111adfc
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/InterruptedIOException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InterruptedIOException extends Exception {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/OutputStream.java b/JCL/converterJclMin1.5/src/java/io/OutputStream.java
new file mode 100644
index 0000000000..8d9756265b
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/OutputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class OutputStream {
+
+ public void write(byte b[]) throws IOException {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/PrintStream.java b/JCL/converterJclMin1.5/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..503f080425
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/PrintStream.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintStream {
+
+ public void println() {
+ }
+
+ public void println(String s) {
+ }
+
+ public void println(int i) {
+ }
+
+ public void println(Object o) {
+ }
+
+ public void print(String s) {
+ }
+
+ public void print(Object o) {
+ }
+
+ public void print(int i) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/PrintWriter.java b/JCL/converterJclMin1.5/src/java/io/PrintWriter.java
new file mode 100644
index 0000000000..ec7e885e07
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/PrintWriter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintWriter extends Writer {
+ public PrintWriter(ByteArrayOutputStream stream) {
+ }
+ public PrintWriter(Writer w) {
+ }
+ public void print(String s) {
+ }
+ public void print(char[] tab) {
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+ public void println(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/Reader.java b/JCL/converterJclMin1.5/src/java/io/Reader.java
new file mode 100644
index 0000000000..bb74ec22fa
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/Reader.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class Reader {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/Serializable.java b/JCL/converterJclMin1.5/src/java/io/Serializable.java
new file mode 100644
index 0000000000..e33731bec8
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/Serializable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public interface Serializable {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/StringWriter.java b/JCL/converterJclMin1.5/src/java/io/StringWriter.java
new file mode 100644
index 0000000000..84631fdee0
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/StringWriter.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class StringWriter extends Writer {
+
+ public StringBuffer getBuffer() {
+ return null;
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/UnsupportedEncodingException.java b/JCL/converterJclMin1.5/src/java/io/UnsupportedEncodingException.java
new file mode 100644
index 0000000000..916b5ccdcd
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/UnsupportedEncodingException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class UnsupportedEncodingException extends IOException {
+ public UnsupportedEncodingException(String s) {
+ super(s);
+ }
+ public UnsupportedEncodingException() {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/io/Writer.java b/JCL/converterJclMin1.5/src/java/io/Writer.java
new file mode 100644
index 0000000000..8a198ae50c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/io/Writer.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public abstract class Writer {
+ public abstract void flush() throws IOException;
+ public abstract void close() throws IOException;
+ public void write(String str) throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ArithmeticException.java b/JCL/converterJclMin1.5/src/java/lang/ArithmeticException.java
new file mode 100644
index 0000000000..063baae8d8
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ArithmeticException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArithmeticException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ArrayIndexOutOfBoundsException.java b/JCL/converterJclMin1.5/src/java/lang/ArrayIndexOutOfBoundsException.java
new file mode 100644
index 0000000000..af436866fe
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ArrayIndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/AssertionError.java b/JCL/converterJclMin1.5/src/java/lang/AssertionError.java
new file mode 100644
index 0000000000..73b789252c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/AssertionError.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class AssertionError extends Error {
+
+ /**
+ * Constructor for AssertionError.
+ * @param s
+ */
+ public AssertionError(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for AssertionError.
+ */
+ public AssertionError() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Boolean.java b/JCL/converterJclMin1.5/src/java/lang/Boolean.java
new file mode 100644
index 0000000000..198c9287b1
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Boolean.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Boolean {
+ public static final Boolean TRUE = new Boolean(true);
+ public static final Boolean FALSE = new Boolean(false);
+ public Boolean(boolean b) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Byte.java b/JCL/converterJclMin1.5/src/java/lang/Byte.java
new file mode 100644
index 0000000000..75c71a1c00
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Byte.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Byte extends Number implements Comparable<Byte> {
+ private static final long serialVersionUID = 8750891329089001085L;
+ public Byte(byte b) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Byte b) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Character.java b/JCL/converterJclMin1.5/src/java/lang/Character.java
new file mode 100644
index 0000000000..337c148689
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Character.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Character {
+ public Character(char c) {
+ }
+ public static char toLowerCase(char c) {
+ return ' ';
+ }
+
+ public static int getNumericValue(char c) {
+ return 0;
+ }
+
+ public static int digit(char ch, int radix) {
+ return 0;
+ }
+ public static boolean isWhitespace(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierStart(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierPart(char c) {
+ return false;
+ }
+ public static boolean isDigit(char c) {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Class.java b/JCL/converterJclMin1.5/src/java/lang/Class.java
new file mode 100644
index 0000000000..7e82f809c8
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Class.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.InputStream;
+
+public class Class<T> {
+ public String getName() {
+ return null;
+ }
+ public InputStream getResourceAsStream(String s) {
+ return null;
+ }
+
+ public native Class<? super T> getSuperclass();
+
+ public T newInstance() throws InstantiationException, IllegalAccessException {
+ return null;
+ }
+
+ public static Class<?> forName(String className) throws ClassNotFoundException {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ClassCastException.java b/JCL/converterJclMin1.5/src/java/lang/ClassCastException.java
new file mode 100644
index 0000000000..51bbbd2125
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ClassCastException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ClassCastException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin1.5/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..838399474e
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class ClassNotFoundException extends Exception {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin1.5/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..2074efbf9e
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Cloneable.java b/JCL/converterJclMin1.5/src/java/lang/Cloneable.java
new file mode 100644
index 0000000000..bc1cb76200
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Cloneable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Cloneable {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Comparable.java b/JCL/converterJclMin1.5/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..fae6b35eb2
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Comparable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Comparable<T> {
+ public int compareTo(T o);
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Deprecated.java b/JCL/converterJclMin1.5/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..b065093472
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Deprecated.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.*;
+
+@Retention(RUNTIME)
+public @interface Deprecated {}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Double.java b/JCL/converterJclMin1.5/src/java/lang/Double.java
new file mode 100644
index 0000000000..18312efacb
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Double.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Double extends Number implements Comparable<Double> {
+ private static final long serialVersionUID = -5839202747810229696L;
+ public Double(double d) {
+ }
+ public static String toString(double d) {
+ return null;
+ }
+ public static Double valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final double POSITIVE_INFINITY = 1.0 / 0.0;
+ public static boolean isNaN(double v) {
+ return false;
+ }
+ public double doubleValue() {
+ return 0.0;
+ }
+ public static final double MAX_VALUE = 1.7976931348623157e+308;
+ public static final double MIN_VALUE = 4.9e-324;
+ public static final double NaN = 0.0d / 0.0;
+
+ public static native double longBitsToDouble(long bits);
+ public static native long doubleToLongBits(double value);
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+
+ public static double parseDouble(String s) {
+ return 0.0;
+ }
+ public int compareTo(Double d) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Enum.java b/JCL/converterJclMin1.5/src/java/lang/Enum.java
new file mode 100644
index 0000000000..13aba40055
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Enum.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>,
+ java.io.Serializable {
+
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+
+ public final String name() {
+ return null;
+ }
+
+ public final int ordinal() {
+ return 0;
+ }
+
+ public final int compareTo(T o) {
+ return 0;
+ }
+
+ public final Class<T> getDeclaringClass() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.5/src/java/lang/Error.java b/JCL/converterJclMin1.5/src/java/lang/Error.java
new file mode 100644
index 0000000000..fc4766d731
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Error.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(String s) {
+ super(s);
+ }
+
+ public Error() {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Exception.java b/JCL/converterJclMin1.5/src/java/lang/Exception.java
new file mode 100644
index 0000000000..f7969390d9
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ }
+ public Exception(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ExceptionInInitializerError.java b/JCL/converterJclMin1.5/src/java/lang/ExceptionInInitializerError.java
new file mode 100644
index 0000000000..907abda50d
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ExceptionInInitializerError.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ExceptionInInitializerError extends Error {
+ public ExceptionInInitializerError(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Float.java b/JCL/converterJclMin1.5/src/java/lang/Float.java
new file mode 100644
index 0000000000..fd5313bde3
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Float.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Float extends Number implements Comparable<Float> {
+ private static final long serialVersionUID = -872370025937303716L;
+ public static final float NaN = 0.0f / 0.0f;
+ public Float(float f) {
+ }
+ public static native float intBitsToFloat(int bits);
+ public static Float valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final float POSITIVE_INFINITY = 1.0f / 0.0f;
+ public static boolean isNaN(float v) {
+ return false;
+ }
+ public float floatValue() {
+ return 0.0f;
+ }
+ public static final float MAX_VALUE = 3.4028235e+38f;
+ public static final float MIN_VALUE = 1.4e-45f;
+ public static native int floatToIntBits(float value);
+ public static String toString(float f) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Float f) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin1.5/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..4b3861fa0a
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalAccessException extends Exception {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin1.5/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..0e7fb8025f
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+ public IllegalMonitorStateException(String s) {
+ }
+ public IllegalMonitorStateException() {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/IndexOutOfBoundsException.java b/JCL/converterJclMin1.5/src/java/lang/IndexOutOfBoundsException.java
new file mode 100644
index 0000000000..7230956f64
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/IndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class IndexOutOfBoundsException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/InstantiationException.java b/JCL/converterJclMin1.5/src/java/lang/InstantiationException.java
new file mode 100644
index 0000000000..c6b5283aa9
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/InstantiationException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InstantiationException extends Exception {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Integer.java b/JCL/converterJclMin1.5/src/java/lang/Integer.java
new file mode 100644
index 0000000000..5cdeb3415d
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Integer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Integer extends Number implements Comparable<Integer> {
+ private static final long serialVersionUID = 6462609062775655000L;
+
+ public Integer(int i) {
+ }
+ public Integer(String s) {
+ }
+ public static final int MAX_VALUE= 2147483647;
+ public static final int MIN_VALUE= -2147483647;
+
+ public static int parseInt(String s) throws NumberFormatException {
+ return 0;
+ }
+ public static String toHexString(int i) {
+ return null;
+ }
+ public static String toString(int i) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Integer i) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/InterruptedException.java b/JCL/converterJclMin1.5/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..8bbd866439
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/InterruptedException.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Iterable.java b/JCL/converterJclMin1.5/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..9e1be1a38c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Iterable.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.util.Iterator;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Long.java b/JCL/converterJclMin1.5/src/java/lang/Long.java
new file mode 100644
index 0000000000..f5f7357ac1
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Long.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Long extends Number implements Comparable<Long> {
+ private static final long serialVersionUID = 7046418566711138668L;
+ public static final long MIN_VALUE = 0x8000000000000000L;
+ public static final long MAX_VALUE = 0x7fffffffffffffffL;
+ public Long(long l) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Long l) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Math.java b/JCL/converterJclMin1.5/src/java/lang/Math.java
new file mode 100644
index 0000000000..5183719463
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Math.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Math {
+
+ public static int min(int a, int b) {
+ return 0;
+ }
+ public static int max(int a, int b) {
+ return 0;
+ }
+ public static int abs(int a) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin1.5/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 0000000000..b6eefdc89e
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2020 GK Software SE and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package java.lang;
+public class NoSuchFieldError extends IncompatibleClassChangeError {
+ public NoSuchFieldError() { super(); }
+ public NoSuchFieldError(String s) {super(s);}
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/NullPointerException.java b/JCL/converterJclMin1.5/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..6a76c3c57a
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/NullPointerException.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class NullPointerException extends RuntimeException {
+
+ /**
+ * Constructor for NullPointerException.
+ * @param s
+ */
+ public NullPointerException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for NullPointerException.
+ */
+ public NullPointerException() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Number.java b/JCL/converterJclMin1.5/src/java/lang/Number.java
new file mode 100644
index 0000000000..c8ccd0833a
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Number.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public abstract class Number implements java.io.Serializable {
+ private static final long serialVersionUID = 3166984097235214156L;
+ public abstract int intValue();
+ public abstract long longValue();
+ public abstract float floatValue();
+ public abstract double doubleValue();
+ public byte byteValue() {
+ return (byte) intValue();
+ }
+ public short shortValue() {
+ return (short) intValue();
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/NumberFormatException.java b/JCL/converterJclMin1.5/src/java/lang/NumberFormatException.java
new file mode 100644
index 0000000000..db1be617e0
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/NumberFormatException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class NumberFormatException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Object.java b/JCL/converterJclMin1.5/src/java/lang/Object.java
new file mode 100644
index 0000000000..9ed67c1b01
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Object.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Object {
+
+ public Object() {
+ }
+ protected Object clone() throws CloneNotSupportedException {
+ return null;
+ }
+ public boolean equals(Object obj) {
+ return false;
+ }
+ protected void finalize() throws Throwable {
+ }
+ public final native Class<? extends Object> getClass();
+ public int hashCode() {
+ return -1;
+ }
+ public final void notify() throws IllegalMonitorStateException {
+ }
+ public final void notifyAll() throws IllegalMonitorStateException {
+ }
+ public String toString() {
+ return null;
+ }
+ public final void wait() throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis) throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis, int nanos)
+ throws IllegalMonitorStateException, InterruptedException {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Override.java b/JCL/converterJclMin1.5/src/java/lang/Override.java
new file mode 100644
index 0000000000..e30eba7b6d
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Override.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+
+@Target(ElementType.METHOD) @Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.5/src/java/lang/Runnable.java b/JCL/converterJclMin1.5/src/java/lang/Runnable.java
new file mode 100644
index 0000000000..d37f3130d1
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Runnable.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Runnable {
+
+ void run();
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/RuntimeException.java b/JCL/converterJclMin1.5/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..be85127b2e
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/RuntimeException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class RuntimeException extends Exception {
+ public RuntimeException(String s) {
+ super(s);
+ }
+ public RuntimeException() {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Short.java b/JCL/converterJclMin1.5/src/java/lang/Short.java
new file mode 100644
index 0000000000..7c36571d45
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Short.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Short extends Number implements Comparable<Short> {
+ private static final long serialVersionUID = -8044450932684282285L;
+ public Short(short s) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Short s) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/String.java b/JCL/converterJclMin1.5/src/java/lang/String.java
new file mode 100644
index 0000000000..27cd154400
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/String.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class String implements java.io.Serializable, Comparable<String> {
+ private static final long serialVersionUID = 1705120029863330869L;
+
+ public String() {
+ }
+ public String(char[] source) {
+ }
+ public String(String s) {
+ }
+ public String(char[] source, int i , int j) {
+ }
+ public int length() {
+ return 0;
+ }
+ public String replace(char oldChar, char newChar) {
+ return null;
+ }
+
+ public int lastIndexOf(char c) {
+ return 0;
+ }
+
+ public String substring(int i, int j) {
+ return null;
+ }
+ public String substring(int i) {
+ return null;
+ }
+ public char[] toCharArray() {
+ return null;
+ }
+ public int indexOf(String s) {
+ return 0;
+ }
+ public int indexOf(String s, int i) {
+ return 0;
+ }
+ public boolean endsWith(String s) {
+ return false;
+ }
+ public static String valueOf(int i) {
+ return null;
+ }
+ public static String valueOf(Object o) {
+ return null;
+ }
+ public static String valueOf(char[] tab) {
+ return null;
+ }
+ public static String valueOf(char[] tab, int i, int j) {
+ return null;
+ }
+ public int compareTo(String s) {
+ return 0;
+ }
+ public int indexOf(int ch, int fromIndex) {
+ return 0;
+ }
+ public char charAt(int i) {
+ return ' ';
+ }
+ public String trim() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/StringBuffer.java b/JCL/converterJclMin1.5/src/java/lang/StringBuffer.java
new file mode 100644
index 0000000000..f77dd695b0
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/StringBuffer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class StringBuffer {
+ public StringBuffer() {
+ }
+ public StringBuffer(String s) {
+ }
+ public StringBuffer(int i) {
+ }
+ public synchronized StringBuffer insert(int offset, String str) {
+ return this;
+ }
+ public synchronized StringBuffer append(String s) {
+ return this;
+ }
+ public synchronized StringBuffer append(StringBuffer buffer) {
+ return this;
+ }
+ public synchronized StringBuffer append(boolean b) {
+ return this;
+ }
+ public synchronized StringBuffer append(int i) {
+ return this;
+ }
+ public synchronized StringBuffer append(long l) {
+ return this;
+ }
+ public synchronized StringBuffer append(float f) {
+ return this;
+ }
+ public synchronized StringBuffer append(double d) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o, int i, int j) {
+ return this;
+ }
+ public synchronized StringBuffer append(Object o) {
+ return this;
+ }
+ public int length() {
+ return 0;
+ }
+ public char[] getChars(int i, int j, char[] tab, int k) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/SuppressWarnings.java b/JCL/converterJclMin1.5/src/java/lang/SuppressWarnings.java
new file mode 100644
index 0000000000..7aa7548f57
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/SuppressWarnings.java
@@ -0,0 +1,11 @@
+package java.lang;
+
+import static java.lang.annotation.ElementType.*;
+
+import java.lang.annotation.*;
+
+@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface SuppressWarnings {
+ String[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.5/src/java/lang/System.java b/JCL/converterJclMin1.5/src/java/lang/System.java
new file mode 100644
index 0000000000..a13acd2404
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/System.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+
+public class System {
+
+ public static PrintStream err;
+ public static PrintStream out;
+
+ public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
+ public static String getProperty(String s) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Throwable.java b/JCL/converterJclMin1.5/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..42ebfd75a1
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Throwable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+import java.io.Writer;
+
+public class Throwable {
+ public Throwable(String s) {
+ }
+ public Throwable() {
+ }
+
+ public void printStackTrace() {
+ }
+
+ public void printStackTrace(Writer w) {
+ }
+
+ public void printStackTrace(PrintStream w) {
+ }
+ public String getMessage() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/Void.java b/JCL/converterJclMin1.5/src/java/lang/Void.java
new file mode 100644
index 0000000000..72e9ca2bec
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/Void.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Void {} \ No newline at end of file
diff --git a/JCL/converterJclMin1.5/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin1.5/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..f6dbed6917
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public interface Annotation {
+ boolean equals(Object obj);
+
+ int hashCode();
+
+ String toString();
+
+ Class<? extends Annotation> annotationType();
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin1.5/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..62caf2132c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public enum ElementType {
+ TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/annotation/Retention.java b/JCL/converterJclMin1.5/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..b51bfad6a7
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/annotation/Retention.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin1.5/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..cbd3bfcc5c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public enum RetentionPolicy {
+ SOURCE, CLASS, RUNTIME
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/annotation/Target.java b/JCL/converterJclMin1.5/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..bdfbeebd39
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/annotation/Target.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ref/Reference.java b/JCL/converterJclMin1.5/src/java/lang/ref/Reference.java
new file mode 100644
index 0000000000..4d163a8bd1
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ref/Reference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class Reference {
+ public Object get() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ref/ReferenceQueue.java b/JCL/converterJclMin1.5/src/java/lang/ref/ReferenceQueue.java
new file mode 100644
index 0000000000..9fe70bdafe
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ref/ReferenceQueue.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class ReferenceQueue {
+ public Reference poll() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/lang/ref/WeakReference.java b/JCL/converterJclMin1.5/src/java/lang/ref/WeakReference.java
new file mode 100644
index 0000000000..a45438ab53
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/lang/ref/WeakReference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+
+public class WeakReference extends Reference {
+ public WeakReference(Object o, ReferenceQueue queue) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/net/MalformedURLException.java b/JCL/converterJclMin1.5/src/java/net/MalformedURLException.java
new file mode 100644
index 0000000000..887f4a7c4b
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/net/MalformedURLException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.net;
+
+public class MalformedURLException extends Exception {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/text/NumberFormat.java b/JCL/converterJclMin1.5/src/java/text/NumberFormat.java
new file mode 100644
index 0000000000..93a29b63cf
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/text/NumberFormat.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.text;
+
+public class NumberFormat {
+
+ public final static NumberFormat getInstance() {
+ return null;
+ }
+
+ public final String format (double d) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/AbstractCollection.java b/JCL/converterJclMin1.5/src/java/util/AbstractCollection.java
new file mode 100644
index 0000000000..89e6b86afe
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/AbstractCollection.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractCollection<E> implements Collection<E> {
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/AbstractList.java b/JCL/converterJclMin1.5/src/java/util/AbstractList.java
new file mode 100644
index 0000000000..ab84c73f8a
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/AbstractList.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractList<E> extends AbstractCollection<E> implements List<E> {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.5/src/java/util/AbstractSet.java b/JCL/converterJclMin1.5/src/java/util/AbstractSet.java
new file mode 100644
index 0000000000..c93ad94dad
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/AbstractSet.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractSet<E> extends AbstractCollection<E> implements Set<E> {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.5/src/java/util/ArrayList.java b/JCL/converterJclMin1.5/src/java/util/ArrayList.java
new file mode 100644
index 0000000000..08693f0aa6
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/ArrayList.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+import java.io.Serializable;
+
+public class ArrayList<T> extends AbstractList<T> implements List<T>, RandomAccess, Cloneable, Serializable {
+ private static final long serialVersionUID = -2169998406647523911L;
+ public ArrayList(int i) {
+ }
+ public ArrayList() {
+ }
+ public T[] toArray(T[] o) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public boolean add(T o) {
+ return false;
+ }
+ public int indexOf(T o) {
+ return 0;
+ }
+ public T remove(int index) {
+ return null;
+ }
+ public T get(int index) {
+ return null;
+ }
+ public boolean contains(T o) {
+ return false;
+ }
+ public Iterator<T> iterator() {
+ return null;
+ }
+ public boolean addAll(Collection<T> c) {
+ return false;
+ }
+ public void set(int i, T o) {
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Arrays.java b/JCL/converterJclMin1.5/src/java/util/Arrays.java
new file mode 100644
index 0000000000..758e7004e9
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Arrays.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class Arrays {
+ public static void sort(Object[] tab) {
+ }
+ public static <T> List<T> asList(T... a) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Collection.java b/JCL/converterJclMin1.5/src/java/util/Collection.java
new file mode 100644
index 0000000000..4415a6b508
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Collection.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Collections.java b/JCL/converterJclMin1.5/src/java/util/Collections.java
new file mode 100644
index 0000000000..fa2220d3ce
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Collections.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Collections {
+ public static <T extends Comparable<? super T>> void sort(List<T> list) {
+ }
+
+ public static final <K,V> Map<K,V> emptyMap() {
+ return null;
+ }
+ public static final <T> List<T> emptyList() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Enumeration.java b/JCL/converterJclMin1.5/src/java/util/Enumeration.java
new file mode 100644
index 0000000000..71ce4fb586
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Enumeration.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Enumeration {
+
+ public boolean hasMoreElements();
+
+ public Object nextElement();
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/HashMap.java b/JCL/converterJclMin1.5/src/java/util/HashMap.java
new file mode 100644
index 0000000000..d22a3176c5
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/HashMap.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class HashMap<K,V> implements Map<K,V> {
+ public HashMap(int i) {
+ }
+ public V get(K k) {
+ return null;
+ }
+ public boolean containsKey(K k) {
+ return false;
+ }
+ public void put(K k, V v) {
+ }
+ public int size() {
+ return 0;
+ }
+ public Set<K> keySet() {
+ return null;
+ }
+ public Collection<V> values() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/HashSet.java b/JCL/converterJclMin1.5/src/java/util/HashSet.java
new file mode 100644
index 0000000000..6e3afcc8b3
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/HashSet.java
@@ -0,0 +1,22 @@
+package java.util;
+
+import java.io.Serializable;
+
+public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, Serializable {
+ private static final long serialVersionUID = 4886489800857586866L;
+ public Iterator<E> iterator() {
+ return null;
+ }
+ public boolean addAll(Collection<E> c) {
+ return false;
+ }
+ public E get(int index) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public E[] toArray(E[] o) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Hashtable.java b/JCL/converterJclMin1.5/src/java/util/Hashtable.java
new file mode 100644
index 0000000000..fc2c5eb10f
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Hashtable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Hashtable<U, V> implements Map<U, V> {
+ public Hashtable(int i) {
+ }
+ public V get(U u) {
+ return null;
+ }
+ public boolean containsKey(U u) {
+ return false;
+ }
+ public void put(U u, V v) {
+ }
+ public synchronized Enumeration elements() {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public synchronized Enumeration keys() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Iterator.java b/JCL/converterJclMin1.5/src/java/util/Iterator.java
new file mode 100644
index 0000000000..1356cd55a2
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Iterator.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/List.java b/JCL/converterJclMin1.5/src/java/util/List.java
new file mode 100644
index 0000000000..8039b14743
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/List.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface List<T> extends Collection<T> {
+ public boolean add(T o);
+ public void set(int i, T o);
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Locale.java b/JCL/converterJclMin1.5/src/java/util/Locale.java
new file mode 100644
index 0000000000..d591b3946a
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Locale.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Locale {
+ public static Locale getDefault() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Map.java b/JCL/converterJclMin1.5/src/java/util/Map.java
new file mode 100644
index 0000000000..fc06d3cece
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Map.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Map<K,V> {
+
+ public V get(K k);
+ public boolean containsKey(K k);
+ public void put(K k, V v);
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/MissingResourceException.java b/JCL/converterJclMin1.5/src/java/util/MissingResourceException.java
new file mode 100644
index 0000000000..f5f7c87e82
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/MissingResourceException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class MissingResourceException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/NoSuchElementException.java b/JCL/converterJclMin1.5/src/java/util/NoSuchElementException.java
new file mode 100644
index 0000000000..a049d80d09
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/NoSuchElementException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class NoSuchElementException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/RandomAccess.java b/JCL/converterJclMin1.5/src/java/util/RandomAccess.java
new file mode 100644
index 0000000000..78870df3a5
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/RandomAccess.java
@@ -0,0 +1,3 @@
+package java.util;
+
+public interface RandomAccess {}
diff --git a/JCL/converterJclMin1.5/src/java/util/ResourceBundle.java b/JCL/converterJclMin1.5/src/java/util/ResourceBundle.java
new file mode 100644
index 0000000000..027b99f365
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/ResourceBundle.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public abstract class ResourceBundle {
+
+ public static final ResourceBundle getBundle(String baseName, Locale locale) {
+ return null;
+ }
+
+ public final String getString(String key) {
+ return null;
+ }
+ public abstract Enumeration getKeys();
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Set.java b/JCL/converterJclMin1.5/src/java/util/Set.java
new file mode 100644
index 0000000000..64284b40a8
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Set.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public interface Set<U> extends Collection<U> {
+ public Iterator<U> iterator();
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/StringTokenizer.java b/JCL/converterJclMin1.5/src/java/util/StringTokenizer.java
new file mode 100644
index 0000000000..86214d8596
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/StringTokenizer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class StringTokenizer {
+
+ public StringTokenizer(String toBeParsed, String delimiters) {
+ }
+
+ public int countTokens() {
+ return 0;
+ }
+
+ public String nextToken() {
+ return null;
+ }
+
+ public boolean hasMoreTokens() {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/Vector.java b/JCL/converterJclMin1.5/src/java/util/Vector.java
new file mode 100644
index 0000000000..7f8630a58c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/Vector.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Vector<E> {
+
+ public Vector() {
+ }
+
+ public Vector(int i) {
+ }
+
+ public int size() {
+ return 0;
+ }
+
+ public E get(int i) {
+ return null;
+ }
+
+ public boolean add(E o) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/zip/ZipEntry.java b/JCL/converterJclMin1.5/src/java/util/zip/ZipEntry.java
new file mode 100644
index 0000000000..7c82b06d8c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/zip/ZipEntry.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+
+public class ZipEntry {
+ public long getSize() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/java/util/zip/ZipFile.java b/JCL/converterJclMin1.5/src/java/util/zip/ZipFile.java
new file mode 100644
index 0000000000..56c853a2bc
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/java/util/zip/ZipFile.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+import java.io.InputStream;
+
+
+public class ZipFile {
+ public ZipEntry getEntry(String s) {
+ return null;
+ }
+ public InputStream getInputStream(ZipEntry zipEntry) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.5/src/p1/p2/Annot.java b/JCL/converterJclMin1.5/src/p1/p2/Annot.java
new file mode 100644
index 0000000000..e7bea6f88c
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/p1/p2/Annot.java
@@ -0,0 +1,8 @@
+package p1.p2;
+
+/**
+ * Test case for bug 147875
+ */
+public @interface Annot {
+ MyEnum2 value();
+}
diff --git a/JCL/converterJclMin1.5/src/p1/p2/MyEnum.java b/JCL/converterJclMin1.5/src/p1/p2/MyEnum.java
new file mode 100644
index 0000000000..664daea9a8
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/p1/p2/MyEnum.java
@@ -0,0 +1,17 @@
+package p1.p2;
+
+/**
+ * Test case for bug 147875
+ */
+public enum MyEnum {
+
+ @Annot(MyEnum2.B)
+ A,
+ @Annot(MyEnum2.C)
+ B,
+ @Annot(MyEnum2.A)
+ C,
+ @Annot(MyEnum2.D)
+ D;
+
+}
diff --git a/JCL/converterJclMin1.5/src/p1/p2/MyEnum2.java b/JCL/converterJclMin1.5/src/p1/p2/MyEnum2.java
new file mode 100644
index 0000000000..f07c0b66bc
--- /dev/null
+++ b/JCL/converterJclMin1.5/src/p1/p2/MyEnum2.java
@@ -0,0 +1,7 @@
+package p1.p2;
+
+public enum MyEnum2 {
+
+ A, B, C, D;
+
+}
diff --git a/JCL/converterJclMin1.7/.classpath b/JCL/converterJclMin1.7/.classpath
new file mode 100644
index 0000000000..51a8bbad89
--- /dev/null
+++ b/JCL/converterJclMin1.7/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin1.7/.project b/JCL/converterJclMin1.7/.project
new file mode 100644
index 0000000000..74f0037702
--- /dev/null
+++ b/JCL/converterJclMin1.7/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin1.7</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin1.7/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin1.7/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..ec1937b3f3
--- /dev/null
+++ b/JCL/converterJclMin1.7/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/JCL/converterJclMin1.7/src/java/awt/List.java b/JCL/converterJclMin1.7/src/java/awt/List.java
new file mode 100644
index 0000000000..b2fd6f7c24
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/awt/List.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.awt;
+
+public class List {
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/BufferedInputStream.java b/JCL/converterJclMin1.7/src/java/io/BufferedInputStream.java
new file mode 100644
index 0000000000..aa574a1930
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/BufferedInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedInputStream extends InputStream {
+ public BufferedInputStream(InputStream inputStream) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/BufferedOutputStream.java b/JCL/converterJclMin1.7/src/java/io/BufferedOutputStream.java
new file mode 100644
index 0000000000..3ab0e26fc5
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/BufferedOutputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedOutputStream extends OutputStream {
+ public BufferedOutputStream(FileOutputStream outputStream) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/BufferedWriter.java b/JCL/converterJclMin1.7/src/java/io/BufferedWriter.java
new file mode 100644
index 0000000000..61122c1b2f
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/BufferedWriter.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedWriter extends Writer {
+
+ public BufferedWriter(Writer writer) {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/ByteArrayInputStream.java b/JCL/converterJclMin1.7/src/java/io/ByteArrayInputStream.java
new file mode 100644
index 0000000000..7f095dcbcb
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/ByteArrayInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayInputStream extends InputStream {
+ public ByteArrayInputStream(byte[] b) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/ByteArrayOutputStream.java b/JCL/converterJclMin1.7/src/java/io/ByteArrayOutputStream.java
new file mode 100644
index 0000000000..8af40644cc
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/ByteArrayOutputStream.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayOutputStream extends OutputStream {
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/File.java b/JCL/converterJclMin1.7/src/java/io/File.java
new file mode 100644
index 0000000000..e0465e47fa
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/File.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class File {
+ public static final char separatorChar = '\\';
+ public static final String separator = "\\"; //$NON-NLS-1$
+
+ public File(String s) {
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean isDirectory() {
+ return false;
+ }
+
+ public String getAbsolutePath() {
+ return null;
+ }
+
+ public boolean mkdirs() {
+ return false;
+ }
+
+ public boolean mkdir() {
+ return false;
+ }
+
+ public String getName() {
+ return null;
+ }
+ public long length() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/FileInputStream.java b/JCL/converterJclMin1.7/src/java/io/FileInputStream.java
new file mode 100644
index 0000000000..c51d1be33c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/FileInputStream.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileInputStream extends InputStream {
+
+ public FileInputStream(File f) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/FileOutputStream.java b/JCL/converterJclMin1.7/src/java/io/FileOutputStream.java
new file mode 100644
index 0000000000..c643bf9c41
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/FileOutputStream.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileOutputStream extends OutputStream {
+ public FileOutputStream(File f) {
+ }
+ public FileOutputStream(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/FileWriter.java b/JCL/converterJclMin1.7/src/java/io/FileWriter.java
new file mode 100644
index 0000000000..667a188869
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/FileWriter.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileWriter extends Writer {
+
+ public FileWriter(String s) {
+ }
+ public void flush() throws IOException {
+ }
+
+ public void close() throws IOException {
+ }
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/IOException.java b/JCL/converterJclMin1.7/src/java/io/IOException.java
new file mode 100644
index 0000000000..e9dabf8df2
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/IOException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class IOException extends Exception {
+ private static final long serialVersionUID = 420068904675281479L;
+ public IOException(String s) {
+ super(s);
+ }
+ public IOException() {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/InputStream.java b/JCL/converterJclMin1.7/src/java/io/InputStream.java
new file mode 100644
index 0000000000..8aa222e902
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/InputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InputStream {
+ public void close() throws IOException {
+ }
+ public int available() throws IOException {
+ return 0;
+ }
+ public int read(byte b[], int off, int len) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/InputStreamReader.java b/JCL/converterJclMin1.7/src/java/io/InputStreamReader.java
new file mode 100644
index 0000000000..a9012a34b8
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/InputStreamReader.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class InputStreamReader extends Reader {
+ public InputStreamReader(InputStream inputStream) {
+ }
+ public InputStreamReader(InputStream stream, String s) throws UnsupportedEncodingException {
+ }
+ public int read(char cbuf[], int offset, int length) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/InterruptedIOException.java b/JCL/converterJclMin1.7/src/java/io/InterruptedIOException.java
new file mode 100644
index 0000000000..c727ca292d
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/InterruptedIOException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InterruptedIOException extends Exception {
+ private static final long serialVersionUID = -2623465050370205911L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/OutputStream.java b/JCL/converterJclMin1.7/src/java/io/OutputStream.java
new file mode 100644
index 0000000000..8d9756265b
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/OutputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class OutputStream {
+
+ public void write(byte b[]) throws IOException {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/PrintStream.java b/JCL/converterJclMin1.7/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..503f080425
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/PrintStream.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintStream {
+
+ public void println() {
+ }
+
+ public void println(String s) {
+ }
+
+ public void println(int i) {
+ }
+
+ public void println(Object o) {
+ }
+
+ public void print(String s) {
+ }
+
+ public void print(Object o) {
+ }
+
+ public void print(int i) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/PrintWriter.java b/JCL/converterJclMin1.7/src/java/io/PrintWriter.java
new file mode 100644
index 0000000000..ec7e885e07
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/PrintWriter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintWriter extends Writer {
+ public PrintWriter(ByteArrayOutputStream stream) {
+ }
+ public PrintWriter(Writer w) {
+ }
+ public void print(String s) {
+ }
+ public void print(char[] tab) {
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+ public void println(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/Reader.java b/JCL/converterJclMin1.7/src/java/io/Reader.java
new file mode 100644
index 0000000000..bb74ec22fa
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/Reader.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class Reader {
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/Serializable.java b/JCL/converterJclMin1.7/src/java/io/Serializable.java
new file mode 100644
index 0000000000..e33731bec8
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/Serializable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public interface Serializable {
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/StringWriter.java b/JCL/converterJclMin1.7/src/java/io/StringWriter.java
new file mode 100644
index 0000000000..84631fdee0
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/StringWriter.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class StringWriter extends Writer {
+
+ public StringBuffer getBuffer() {
+ return null;
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/UnsupportedEncodingException.java b/JCL/converterJclMin1.7/src/java/io/UnsupportedEncodingException.java
new file mode 100644
index 0000000000..6eb4f03784
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/UnsupportedEncodingException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class UnsupportedEncodingException extends IOException {
+ private static final long serialVersionUID = 1031403719398591519L;
+ public UnsupportedEncodingException(String s) {
+ super(s);
+ }
+ public UnsupportedEncodingException() {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/io/Writer.java b/JCL/converterJclMin1.7/src/java/io/Writer.java
new file mode 100644
index 0000000000..8a198ae50c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/io/Writer.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public abstract class Writer {
+ public abstract void flush() throws IOException;
+ public abstract void close() throws IOException;
+ public void write(String str) throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ArithmeticException.java b/JCL/converterJclMin1.7/src/java/lang/ArithmeticException.java
new file mode 100644
index 0000000000..afe937b4cd
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ArithmeticException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArithmeticException extends RuntimeException {
+ private static final long serialVersionUID = 7325899601264404083L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ArrayIndexOutOfBoundsException.java b/JCL/converterJclMin1.7/src/java/lang/ArrayIndexOutOfBoundsException.java
new file mode 100644
index 0000000000..3838011898
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ArrayIndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
+ private static final long serialVersionUID = -7035391738132728176L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/AssertionError.java b/JCL/converterJclMin1.7/src/java/lang/AssertionError.java
new file mode 100644
index 0000000000..30e69bcbb4
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/AssertionError.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class AssertionError extends Error {
+ private static final long serialVersionUID = 3910378697039934416L;
+ /**
+ * Constructor for AssertionError.
+ * @param s
+ */
+ public AssertionError(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for AssertionError.
+ */
+ public AssertionError() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Boolean.java b/JCL/converterJclMin1.7/src/java/lang/Boolean.java
new file mode 100644
index 0000000000..198c9287b1
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Boolean.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Boolean {
+ public static final Boolean TRUE = new Boolean(true);
+ public static final Boolean FALSE = new Boolean(false);
+ public Boolean(boolean b) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Byte.java b/JCL/converterJclMin1.7/src/java/lang/Byte.java
new file mode 100644
index 0000000000..75c71a1c00
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Byte.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Byte extends Number implements Comparable<Byte> {
+ private static final long serialVersionUID = 8750891329089001085L;
+ public Byte(byte b) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Byte b) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Character.java b/JCL/converterJclMin1.7/src/java/lang/Character.java
new file mode 100644
index 0000000000..337c148689
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Character.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Character {
+ public Character(char c) {
+ }
+ public static char toLowerCase(char c) {
+ return ' ';
+ }
+
+ public static int getNumericValue(char c) {
+ return 0;
+ }
+
+ public static int digit(char ch, int radix) {
+ return 0;
+ }
+ public static boolean isWhitespace(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierStart(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierPart(char c) {
+ return false;
+ }
+ public static boolean isDigit(char c) {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Class.java b/JCL/converterJclMin1.7/src/java/lang/Class.java
new file mode 100644
index 0000000000..7e82f809c8
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Class.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.InputStream;
+
+public class Class<T> {
+ public String getName() {
+ return null;
+ }
+ public InputStream getResourceAsStream(String s) {
+ return null;
+ }
+
+ public native Class<? super T> getSuperclass();
+
+ public T newInstance() throws InstantiationException, IllegalAccessException {
+ return null;
+ }
+
+ public static Class<?> forName(String className) throws ClassNotFoundException {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ClassCastException.java b/JCL/converterJclMin1.7/src/java/lang/ClassCastException.java
new file mode 100644
index 0000000000..72d6810139
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ClassCastException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ClassCastException extends RuntimeException {
+ private static final long serialVersionUID = -2824993730424549317L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin1.7/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..46742b7d4a
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class ClassNotFoundException extends Exception {
+ private static final long serialVersionUID = -7119744281167457228L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin1.7/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..5fb63b9ea1
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+ private static final long serialVersionUID = -3979306935580113776L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Cloneable.java b/JCL/converterJclMin1.7/src/java/lang/Cloneable.java
new file mode 100644
index 0000000000..bc1cb76200
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Cloneable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Cloneable {
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Comparable.java b/JCL/converterJclMin1.7/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..fae6b35eb2
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Comparable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Comparable<T> {
+ public int compareTo(T o);
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Deprecated.java b/JCL/converterJclMin1.7/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..b065093472
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Deprecated.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.*;
+
+@Retention(RUNTIME)
+public @interface Deprecated {}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Double.java b/JCL/converterJclMin1.7/src/java/lang/Double.java
new file mode 100644
index 0000000000..18312efacb
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Double.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Double extends Number implements Comparable<Double> {
+ private static final long serialVersionUID = -5839202747810229696L;
+ public Double(double d) {
+ }
+ public static String toString(double d) {
+ return null;
+ }
+ public static Double valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final double POSITIVE_INFINITY = 1.0 / 0.0;
+ public static boolean isNaN(double v) {
+ return false;
+ }
+ public double doubleValue() {
+ return 0.0;
+ }
+ public static final double MAX_VALUE = 1.7976931348623157e+308;
+ public static final double MIN_VALUE = 4.9e-324;
+ public static final double NaN = 0.0d / 0.0;
+
+ public static native double longBitsToDouble(long bits);
+ public static native long doubleToLongBits(double value);
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+
+ public static double parseDouble(String s) {
+ return 0.0;
+ }
+ public int compareTo(Double d) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Enum.java b/JCL/converterJclMin1.7/src/java/lang/Enum.java
new file mode 100644
index 0000000000..13aba40055
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Enum.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>,
+ java.io.Serializable {
+
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+
+ public final String name() {
+ return null;
+ }
+
+ public final int ordinal() {
+ return 0;
+ }
+
+ public final int compareTo(T o) {
+ return 0;
+ }
+
+ public final Class<T> getDeclaringClass() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/Error.java b/JCL/converterJclMin1.7/src/java/lang/Error.java
new file mode 100644
index 0000000000..5b9b5435fd
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Error.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Error extends Throwable {
+ private static final long serialVersionUID = 9179125830904709243L;
+
+ public Error(String s) {
+ super(s);
+ }
+
+ public Error() {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Exception.java b/JCL/converterJclMin1.7/src/java/lang/Exception.java
new file mode 100644
index 0000000000..9580b40d76
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Exception.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Exception extends Throwable {
+ private static final long serialVersionUID = -3387516993124229948L;
+ public Exception() {
+ }
+ public Exception(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ExceptionInInitializerError.java b/JCL/converterJclMin1.7/src/java/lang/ExceptionInInitializerError.java
new file mode 100644
index 0000000000..2cf1e21702
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ExceptionInInitializerError.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ExceptionInInitializerError extends Error {
+ private static final long serialVersionUID = 2267505642151644179L;
+
+ public ExceptionInInitializerError(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Float.java b/JCL/converterJclMin1.7/src/java/lang/Float.java
new file mode 100644
index 0000000000..fd5313bde3
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Float.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Float extends Number implements Comparable<Float> {
+ private static final long serialVersionUID = -872370025937303716L;
+ public static final float NaN = 0.0f / 0.0f;
+ public Float(float f) {
+ }
+ public static native float intBitsToFloat(int bits);
+ public static Float valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final float POSITIVE_INFINITY = 1.0f / 0.0f;
+ public static boolean isNaN(float v) {
+ return false;
+ }
+ public float floatValue() {
+ return 0.0f;
+ }
+ public static final float MAX_VALUE = 3.4028235e+38f;
+ public static final float MIN_VALUE = 1.4e-45f;
+ public static native int floatToIntBits(float value);
+ public static String toString(float f) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Float f) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin1.7/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..d07dbcff05
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalAccessException extends Exception {
+ private static final long serialVersionUID = 4022280013694488250L;
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin1.7/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..38ea0bfdc0
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+ private static final long serialVersionUID = 3460688064376288846L;
+ public IllegalMonitorStateException(String s) {
+ }
+ public IllegalMonitorStateException() {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/IndexOutOfBoundsException.java b/JCL/converterJclMin1.7/src/java/lang/IndexOutOfBoundsException.java
new file mode 100644
index 0000000000..32bbeb8747
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/IndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class IndexOutOfBoundsException extends RuntimeException {
+ private static final long serialVersionUID = 2192343167556759436L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/InstantiationException.java b/JCL/converterJclMin1.7/src/java/lang/InstantiationException.java
new file mode 100644
index 0000000000..cccda2332a
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/InstantiationException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InstantiationException extends Exception {
+ private static final long serialVersionUID = 6944714408584296262L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Integer.java b/JCL/converterJclMin1.7/src/java/lang/Integer.java
new file mode 100644
index 0000000000..5cdeb3415d
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Integer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Integer extends Number implements Comparable<Integer> {
+ private static final long serialVersionUID = 6462609062775655000L;
+
+ public Integer(int i) {
+ }
+ public Integer(String s) {
+ }
+ public static final int MAX_VALUE= 2147483647;
+ public static final int MIN_VALUE= -2147483647;
+
+ public static int parseInt(String s) throws NumberFormatException {
+ return 0;
+ }
+ public static String toHexString(int i) {
+ return null;
+ }
+ public static String toString(int i) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Integer i) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/InterruptedException.java b/JCL/converterJclMin1.7/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..52b67124d9
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/InterruptedException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InterruptedException extends Exception {
+ private static final long serialVersionUID = 4024069220747256448L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Iterable.java b/JCL/converterJclMin1.7/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..9e1be1a38c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Iterable.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.util.Iterator;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Long.java b/JCL/converterJclMin1.7/src/java/lang/Long.java
new file mode 100644
index 0000000000..f5f7357ac1
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Long.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Long extends Number implements Comparable<Long> {
+ private static final long serialVersionUID = 7046418566711138668L;
+ public static final long MIN_VALUE = 0x8000000000000000L;
+ public static final long MAX_VALUE = 0x7fffffffffffffffL;
+ public Long(long l) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Long l) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Math.java b/JCL/converterJclMin1.7/src/java/lang/Math.java
new file mode 100644
index 0000000000..5183719463
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Math.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Math {
+
+ public static int min(int a, int b) {
+ return 0;
+ }
+ public static int max(int a, int b) {
+ return 0;
+ }
+ public static int abs(int a) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin1.7/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..a516033612
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,28 @@
+package java.lang;
+
+/**
+ * Thrown when a particular method cannot be found.
+ *
+ * @author unascribed
+ * @since JDK1.0
+ */
+public class NoSuchMethodException extends ReflectiveOperationException {
+ private static final long serialVersionUID = 5034388446362600923L;
+
+ /**
+ * Constructs a <code>NoSuchMethodException</code> without a detail message.
+ */
+ public NoSuchMethodException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>NoSuchMethodException</code> with a detail message.
+ *
+ * @param s
+ * the detail message.
+ */
+ public NoSuchMethodException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/NullPointerException.java b/JCL/converterJclMin1.7/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..6e9f4e1358
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/NullPointerException.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class NullPointerException extends RuntimeException {
+ private static final long serialVersionUID = -945245241303869636L;
+
+ /**
+ * Constructor for NullPointerException.
+ * @param s
+ */
+ public NullPointerException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for NullPointerException.
+ */
+ public NullPointerException() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Number.java b/JCL/converterJclMin1.7/src/java/lang/Number.java
new file mode 100644
index 0000000000..c8ccd0833a
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Number.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public abstract class Number implements java.io.Serializable {
+ private static final long serialVersionUID = 3166984097235214156L;
+ public abstract int intValue();
+ public abstract long longValue();
+ public abstract float floatValue();
+ public abstract double doubleValue();
+ public byte byteValue() {
+ return (byte) intValue();
+ }
+ public short shortValue() {
+ return (short) intValue();
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/NumberFormatException.java b/JCL/converterJclMin1.7/src/java/lang/NumberFormatException.java
new file mode 100644
index 0000000000..eeb7eb737c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/NumberFormatException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class NumberFormatException extends RuntimeException {
+ private static final long serialVersionUID = 9070730590112500498L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Object.java b/JCL/converterJclMin1.7/src/java/lang/Object.java
new file mode 100644
index 0000000000..9ed67c1b01
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Object.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Object {
+
+ public Object() {
+ }
+ protected Object clone() throws CloneNotSupportedException {
+ return null;
+ }
+ public boolean equals(Object obj) {
+ return false;
+ }
+ protected void finalize() throws Throwable {
+ }
+ public final native Class<? extends Object> getClass();
+ public int hashCode() {
+ return -1;
+ }
+ public final void notify() throws IllegalMonitorStateException {
+ }
+ public final void notifyAll() throws IllegalMonitorStateException {
+ }
+ public String toString() {
+ return null;
+ }
+ public final void wait() throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis) throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis, int nanos)
+ throws IllegalMonitorStateException, InterruptedException {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Override.java b/JCL/converterJclMin1.7/src/java/lang/Override.java
new file mode 100644
index 0000000000..e30eba7b6d
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Override.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+
+@Target(ElementType.METHOD) @Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin1.7/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 0000000000..46df5a4c81
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Runnable.java b/JCL/converterJclMin1.7/src/java/lang/Runnable.java
new file mode 100644
index 0000000000..d37f3130d1
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Runnable.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Runnable {
+
+ void run();
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/RuntimeException.java b/JCL/converterJclMin1.7/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..6018b82614
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/RuntimeException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class RuntimeException extends Exception {
+ private static final long serialVersionUID = -8038704779788883814L;
+ public RuntimeException(String s) {
+ super(s);
+ }
+ public RuntimeException() {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/SafeVarargs.java b/JCL/converterJclMin1.7/src/java/lang/SafeVarargs.java
new file mode 100644
index 0000000000..765dc3f57e
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/SafeVarargs.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.*;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RUNTIME)
+@Target({CONSTRUCTOR, METHOD})
+public @interface SafeVarargs {} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/Short.java b/JCL/converterJclMin1.7/src/java/lang/Short.java
new file mode 100644
index 0000000000..7c36571d45
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Short.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Short extends Number implements Comparable<Short> {
+ private static final long serialVersionUID = -8044450932684282285L;
+ public Short(short s) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Short s) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/String.java b/JCL/converterJclMin1.7/src/java/lang/String.java
new file mode 100644
index 0000000000..27cd154400
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/String.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class String implements java.io.Serializable, Comparable<String> {
+ private static final long serialVersionUID = 1705120029863330869L;
+
+ public String() {
+ }
+ public String(char[] source) {
+ }
+ public String(String s) {
+ }
+ public String(char[] source, int i , int j) {
+ }
+ public int length() {
+ return 0;
+ }
+ public String replace(char oldChar, char newChar) {
+ return null;
+ }
+
+ public int lastIndexOf(char c) {
+ return 0;
+ }
+
+ public String substring(int i, int j) {
+ return null;
+ }
+ public String substring(int i) {
+ return null;
+ }
+ public char[] toCharArray() {
+ return null;
+ }
+ public int indexOf(String s) {
+ return 0;
+ }
+ public int indexOf(String s, int i) {
+ return 0;
+ }
+ public boolean endsWith(String s) {
+ return false;
+ }
+ public static String valueOf(int i) {
+ return null;
+ }
+ public static String valueOf(Object o) {
+ return null;
+ }
+ public static String valueOf(char[] tab) {
+ return null;
+ }
+ public static String valueOf(char[] tab, int i, int j) {
+ return null;
+ }
+ public int compareTo(String s) {
+ return 0;
+ }
+ public int indexOf(int ch, int fromIndex) {
+ return 0;
+ }
+ public char charAt(int i) {
+ return ' ';
+ }
+ public String trim() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/StringBuffer.java b/JCL/converterJclMin1.7/src/java/lang/StringBuffer.java
new file mode 100644
index 0000000000..f77dd695b0
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/StringBuffer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class StringBuffer {
+ public StringBuffer() {
+ }
+ public StringBuffer(String s) {
+ }
+ public StringBuffer(int i) {
+ }
+ public synchronized StringBuffer insert(int offset, String str) {
+ return this;
+ }
+ public synchronized StringBuffer append(String s) {
+ return this;
+ }
+ public synchronized StringBuffer append(StringBuffer buffer) {
+ return this;
+ }
+ public synchronized StringBuffer append(boolean b) {
+ return this;
+ }
+ public synchronized StringBuffer append(int i) {
+ return this;
+ }
+ public synchronized StringBuffer append(long l) {
+ return this;
+ }
+ public synchronized StringBuffer append(float f) {
+ return this;
+ }
+ public synchronized StringBuffer append(double d) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o, int i, int j) {
+ return this;
+ }
+ public synchronized StringBuffer append(Object o) {
+ return this;
+ }
+ public int length() {
+ return 0;
+ }
+ public char[] getChars(int i, int j, char[] tab, int k) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/SuppressWarnings.java b/JCL/converterJclMin1.7/src/java/lang/SuppressWarnings.java
new file mode 100644
index 0000000000..7aa7548f57
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/SuppressWarnings.java
@@ -0,0 +1,11 @@
+package java.lang;
+
+import static java.lang.annotation.ElementType.*;
+
+import java.lang.annotation.*;
+
+@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface SuppressWarnings {
+ String[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/System.java b/JCL/converterJclMin1.7/src/java/lang/System.java
new file mode 100644
index 0000000000..a13acd2404
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/System.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+
+public class System {
+
+ public static PrintStream err;
+ public static PrintStream out;
+
+ public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
+ public static String getProperty(String s) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Throwable.java b/JCL/converterJclMin1.7/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..55be032fdf
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Throwable.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+import java.io.Serializable;
+import java.io.Writer;
+
+public class Throwable implements Serializable {
+ private static final long serialVersionUID = -282116690407747101L;
+ public Throwable(String s) {
+ }
+ public Throwable() {
+ }
+
+ public void printStackTrace() {
+ }
+
+ public void printStackTrace(Writer w) {
+ }
+
+ public void printStackTrace(PrintStream w) {
+ }
+ public String getMessage() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/Void.java b/JCL/converterJclMin1.7/src/java/lang/Void.java
new file mode 100644
index 0000000000..72e9ca2bec
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/Void.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Void {} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin1.7/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..f6dbed6917
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public interface Annotation {
+ boolean equals(Object obj);
+
+ int hashCode();
+
+ String toString();
+
+ Class<? extends Annotation> annotationType();
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/annotation/Documented.java b/JCL/converterJclMin1.7/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..1826f297a1
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/annotation/Documented.java
@@ -0,0 +1,10 @@
+package java.lang.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+@Documented
+@Retention(RUNTIME)
+@Target(ANNOTATION_TYPE)
+public @interface Documented {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin1.7/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..62caf2132c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public enum ElementType {
+ TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/annotation/Retention.java b/JCL/converterJclMin1.7/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..b51bfad6a7
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/annotation/Retention.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin1.7/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..cbd3bfcc5c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public enum RetentionPolicy {
+ SOURCE, CLASS, RUNTIME
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/annotation/Target.java b/JCL/converterJclMin1.7/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..bdfbeebd39
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/annotation/Target.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..b702132820
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.invoke;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin1.7/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..067d5f9db0
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,16 @@
+package java.lang.invoke;
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ref/Reference.java b/JCL/converterJclMin1.7/src/java/lang/ref/Reference.java
new file mode 100644
index 0000000000..4d163a8bd1
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ref/Reference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class Reference {
+ public Object get() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ref/ReferenceQueue.java b/JCL/converterJclMin1.7/src/java/lang/ref/ReferenceQueue.java
new file mode 100644
index 0000000000..9fe70bdafe
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ref/ReferenceQueue.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class ReferenceQueue {
+ public Reference poll() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/lang/ref/WeakReference.java b/JCL/converterJclMin1.7/src/java/lang/ref/WeakReference.java
new file mode 100644
index 0000000000..a45438ab53
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/lang/ref/WeakReference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+
+public class WeakReference extends Reference {
+ public WeakReference(Object o, ReferenceQueue queue) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/net/MalformedURLException.java b/JCL/converterJclMin1.7/src/java/net/MalformedURLException.java
new file mode 100644
index 0000000000..3c31ec74fe
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/net/MalformedURLException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.net;
+
+public class MalformedURLException extends Exception {
+ private static final long serialVersionUID = -465098896288949281L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/text/NumberFormat.java b/JCL/converterJclMin1.7/src/java/text/NumberFormat.java
new file mode 100644
index 0000000000..93a29b63cf
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/text/NumberFormat.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.text;
+
+public class NumberFormat {
+
+ public final static NumberFormat getInstance() {
+ return null;
+ }
+
+ public final String format (double d) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/AbstractCollection.java b/JCL/converterJclMin1.7/src/java/util/AbstractCollection.java
new file mode 100644
index 0000000000..89e6b86afe
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/AbstractCollection.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractCollection<E> implements Collection<E> {
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/AbstractList.java b/JCL/converterJclMin1.7/src/java/util/AbstractList.java
new file mode 100644
index 0000000000..ab84c73f8a
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/AbstractList.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractList<E> extends AbstractCollection<E> implements List<E> {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/util/AbstractSet.java b/JCL/converterJclMin1.7/src/java/util/AbstractSet.java
new file mode 100644
index 0000000000..c93ad94dad
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/AbstractSet.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractSet<E> extends AbstractCollection<E> implements Set<E> {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/util/ArrayList.java b/JCL/converterJclMin1.7/src/java/util/ArrayList.java
new file mode 100644
index 0000000000..08693f0aa6
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/ArrayList.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+import java.io.Serializable;
+
+public class ArrayList<T> extends AbstractList<T> implements List<T>, RandomAccess, Cloneable, Serializable {
+ private static final long serialVersionUID = -2169998406647523911L;
+ public ArrayList(int i) {
+ }
+ public ArrayList() {
+ }
+ public T[] toArray(T[] o) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public boolean add(T o) {
+ return false;
+ }
+ public int indexOf(T o) {
+ return 0;
+ }
+ public T remove(int index) {
+ return null;
+ }
+ public T get(int index) {
+ return null;
+ }
+ public boolean contains(T o) {
+ return false;
+ }
+ public Iterator<T> iterator() {
+ return null;
+ }
+ public boolean addAll(Collection<T> c) {
+ return false;
+ }
+ public void set(int i, T o) {
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Arrays.java b/JCL/converterJclMin1.7/src/java/util/Arrays.java
new file mode 100644
index 0000000000..3fe9c6f924
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Arrays.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class Arrays {
+ public static void sort(Object[] tab) {
+ }
+ @SafeVarargs
+ public static <T> List<T> asList(T... a) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Collection.java b/JCL/converterJclMin1.7/src/java/util/Collection.java
new file mode 100644
index 0000000000..4415a6b508
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Collection.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Collections.java b/JCL/converterJclMin1.7/src/java/util/Collections.java
new file mode 100644
index 0000000000..fa2220d3ce
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Collections.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Collections {
+ public static <T extends Comparable<? super T>> void sort(List<T> list) {
+ }
+
+ public static final <K,V> Map<K,V> emptyMap() {
+ return null;
+ }
+ public static final <T> List<T> emptyList() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Enumeration.java b/JCL/converterJclMin1.7/src/java/util/Enumeration.java
new file mode 100644
index 0000000000..71ce4fb586
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Enumeration.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Enumeration {
+
+ public boolean hasMoreElements();
+
+ public Object nextElement();
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/HashMap.java b/JCL/converterJclMin1.7/src/java/util/HashMap.java
new file mode 100644
index 0000000000..d22a3176c5
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/HashMap.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class HashMap<K,V> implements Map<K,V> {
+ public HashMap(int i) {
+ }
+ public V get(K k) {
+ return null;
+ }
+ public boolean containsKey(K k) {
+ return false;
+ }
+ public void put(K k, V v) {
+ }
+ public int size() {
+ return 0;
+ }
+ public Set<K> keySet() {
+ return null;
+ }
+ public Collection<V> values() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/HashSet.java b/JCL/converterJclMin1.7/src/java/util/HashSet.java
new file mode 100644
index 0000000000..6e3afcc8b3
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/HashSet.java
@@ -0,0 +1,22 @@
+package java.util;
+
+import java.io.Serializable;
+
+public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, Serializable {
+ private static final long serialVersionUID = 4886489800857586866L;
+ public Iterator<E> iterator() {
+ return null;
+ }
+ public boolean addAll(Collection<E> c) {
+ return false;
+ }
+ public E get(int index) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public E[] toArray(E[] o) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Hashtable.java b/JCL/converterJclMin1.7/src/java/util/Hashtable.java
new file mode 100644
index 0000000000..fc2c5eb10f
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Hashtable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Hashtable<U, V> implements Map<U, V> {
+ public Hashtable(int i) {
+ }
+ public V get(U u) {
+ return null;
+ }
+ public boolean containsKey(U u) {
+ return false;
+ }
+ public void put(U u, V v) {
+ }
+ public synchronized Enumeration elements() {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public synchronized Enumeration keys() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Iterator.java b/JCL/converterJclMin1.7/src/java/util/Iterator.java
new file mode 100644
index 0000000000..1356cd55a2
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Iterator.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/List.java b/JCL/converterJclMin1.7/src/java/util/List.java
new file mode 100644
index 0000000000..8039b14743
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/List.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface List<T> extends Collection<T> {
+ public boolean add(T o);
+ public void set(int i, T o);
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Locale.java b/JCL/converterJclMin1.7/src/java/util/Locale.java
new file mode 100644
index 0000000000..d591b3946a
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Locale.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Locale {
+ public static Locale getDefault() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Map.java b/JCL/converterJclMin1.7/src/java/util/Map.java
new file mode 100644
index 0000000000..fc06d3cece
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Map.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Map<K,V> {
+
+ public V get(K k);
+ public boolean containsKey(K k);
+ public void put(K k, V v);
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/MissingResourceException.java b/JCL/converterJclMin1.7/src/java/util/MissingResourceException.java
new file mode 100644
index 0000000000..3f512497f5
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/MissingResourceException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class MissingResourceException extends RuntimeException {
+ private static final long serialVersionUID = -6463093713113089678L;
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/NoSuchElementException.java b/JCL/converterJclMin1.7/src/java/util/NoSuchElementException.java
new file mode 100644
index 0000000000..855fa6ae99
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/NoSuchElementException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class NoSuchElementException extends RuntimeException {
+ private static final long serialVersionUID = -3741760439480852710L;
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.7/src/java/util/RandomAccess.java b/JCL/converterJclMin1.7/src/java/util/RandomAccess.java
new file mode 100644
index 0000000000..78870df3a5
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/RandomAccess.java
@@ -0,0 +1,3 @@
+package java.util;
+
+public interface RandomAccess {}
diff --git a/JCL/converterJclMin1.7/src/java/util/ResourceBundle.java b/JCL/converterJclMin1.7/src/java/util/ResourceBundle.java
new file mode 100644
index 0000000000..027b99f365
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/ResourceBundle.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public abstract class ResourceBundle {
+
+ public static final ResourceBundle getBundle(String baseName, Locale locale) {
+ return null;
+ }
+
+ public final String getString(String key) {
+ return null;
+ }
+ public abstract Enumeration getKeys();
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Set.java b/JCL/converterJclMin1.7/src/java/util/Set.java
new file mode 100644
index 0000000000..64284b40a8
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Set.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public interface Set<U> extends Collection<U> {
+ public Iterator<U> iterator();
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/StringTokenizer.java b/JCL/converterJclMin1.7/src/java/util/StringTokenizer.java
new file mode 100644
index 0000000000..86214d8596
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/StringTokenizer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class StringTokenizer {
+
+ public StringTokenizer(String toBeParsed, String delimiters) {
+ }
+
+ public int countTokens() {
+ return 0;
+ }
+
+ public String nextToken() {
+ return null;
+ }
+
+ public boolean hasMoreTokens() {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/Vector.java b/JCL/converterJclMin1.7/src/java/util/Vector.java
new file mode 100644
index 0000000000..7f8630a58c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/Vector.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Vector<E> {
+
+ public Vector() {
+ }
+
+ public Vector(int i) {
+ }
+
+ public int size() {
+ return 0;
+ }
+
+ public E get(int i) {
+ return null;
+ }
+
+ public boolean add(E o) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/zip/ZipEntry.java b/JCL/converterJclMin1.7/src/java/util/zip/ZipEntry.java
new file mode 100644
index 0000000000..7c82b06d8c
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/zip/ZipEntry.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+
+public class ZipEntry {
+ public long getSize() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.7/src/java/util/zip/ZipFile.java b/JCL/converterJclMin1.7/src/java/util/zip/ZipFile.java
new file mode 100644
index 0000000000..56c853a2bc
--- /dev/null
+++ b/JCL/converterJclMin1.7/src/java/util/zip/ZipFile.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+import java.io.InputStream;
+
+
+public class ZipFile {
+ public ZipEntry getEntry(String s) {
+ return null;
+ }
+ public InputStream getInputStream(ZipEntry zipEntry) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/.classpath b/JCL/converterJclMin1.8/.classpath
new file mode 100644
index 0000000000..51a8bbad89
--- /dev/null
+++ b/JCL/converterJclMin1.8/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin1.8/.project b/JCL/converterJclMin1.8/.project
new file mode 100644
index 0000000000..53b7e82649
--- /dev/null
+++ b/JCL/converterJclMin1.8/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin1.8</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin1.8/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin1.8/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..ec1937b3f3
--- /dev/null
+++ b/JCL/converterJclMin1.8/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/JCL/converterJclMin1.8/src/java/awt/List.java b/JCL/converterJclMin1.8/src/java/awt/List.java
new file mode 100644
index 0000000000..b2fd6f7c24
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/awt/List.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.awt;
+
+public class List {
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/BufferedInputStream.java b/JCL/converterJclMin1.8/src/java/io/BufferedInputStream.java
new file mode 100644
index 0000000000..aa574a1930
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/BufferedInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedInputStream extends InputStream {
+ public BufferedInputStream(InputStream inputStream) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/BufferedOutputStream.java b/JCL/converterJclMin1.8/src/java/io/BufferedOutputStream.java
new file mode 100644
index 0000000000..3ab0e26fc5
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/BufferedOutputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedOutputStream extends OutputStream {
+ public BufferedOutputStream(FileOutputStream outputStream) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/BufferedWriter.java b/JCL/converterJclMin1.8/src/java/io/BufferedWriter.java
new file mode 100644
index 0000000000..61122c1b2f
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/BufferedWriter.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class BufferedWriter extends Writer {
+
+ public BufferedWriter(Writer writer) {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/ByteArrayInputStream.java b/JCL/converterJclMin1.8/src/java/io/ByteArrayInputStream.java
new file mode 100644
index 0000000000..7f095dcbcb
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/ByteArrayInputStream.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayInputStream extends InputStream {
+ public ByteArrayInputStream(byte[] b) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/ByteArrayOutputStream.java b/JCL/converterJclMin1.8/src/java/io/ByteArrayOutputStream.java
new file mode 100644
index 0000000000..8af40644cc
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/ByteArrayOutputStream.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class ByteArrayOutputStream extends OutputStream {
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/File.java b/JCL/converterJclMin1.8/src/java/io/File.java
new file mode 100644
index 0000000000..e0465e47fa
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/File.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class File {
+ public static final char separatorChar = '\\';
+ public static final String separator = "\\"; //$NON-NLS-1$
+
+ public File(String s) {
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean isDirectory() {
+ return false;
+ }
+
+ public String getAbsolutePath() {
+ return null;
+ }
+
+ public boolean mkdirs() {
+ return false;
+ }
+
+ public boolean mkdir() {
+ return false;
+ }
+
+ public String getName() {
+ return null;
+ }
+ public long length() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/FileInputStream.java b/JCL/converterJclMin1.8/src/java/io/FileInputStream.java
new file mode 100644
index 0000000000..c51d1be33c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/FileInputStream.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileInputStream extends InputStream {
+
+ public FileInputStream(File f) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/FileOutputStream.java b/JCL/converterJclMin1.8/src/java/io/FileOutputStream.java
new file mode 100644
index 0000000000..c643bf9c41
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/FileOutputStream.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileOutputStream extends OutputStream {
+ public FileOutputStream(File f) {
+ }
+ public FileOutputStream(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/FileWriter.java b/JCL/converterJclMin1.8/src/java/io/FileWriter.java
new file mode 100644
index 0000000000..667a188869
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/FileWriter.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class FileWriter extends Writer {
+
+ public FileWriter(String s) {
+ }
+ public void flush() throws IOException {
+ }
+
+ public void close() throws IOException {
+ }
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/IOException.java b/JCL/converterJclMin1.8/src/java/io/IOException.java
new file mode 100644
index 0000000000..e9dabf8df2
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/IOException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class IOException extends Exception {
+ private static final long serialVersionUID = 420068904675281479L;
+ public IOException(String s) {
+ super(s);
+ }
+ public IOException() {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/InputStream.java b/JCL/converterJclMin1.8/src/java/io/InputStream.java
new file mode 100644
index 0000000000..8aa222e902
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/InputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InputStream {
+ public void close() throws IOException {
+ }
+ public int available() throws IOException {
+ return 0;
+ }
+ public int read(byte b[], int off, int len) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/InputStreamReader.java b/JCL/converterJclMin1.8/src/java/io/InputStreamReader.java
new file mode 100644
index 0000000000..a9012a34b8
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/InputStreamReader.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class InputStreamReader extends Reader {
+ public InputStreamReader(InputStream inputStream) {
+ }
+ public InputStreamReader(InputStream stream, String s) throws UnsupportedEncodingException {
+ }
+ public int read(char cbuf[], int offset, int length) throws IOException {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/InterruptedIOException.java b/JCL/converterJclMin1.8/src/java/io/InterruptedIOException.java
new file mode 100644
index 0000000000..c727ca292d
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/InterruptedIOException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class InterruptedIOException extends Exception {
+ private static final long serialVersionUID = -2623465050370205911L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/OutputStream.java b/JCL/converterJclMin1.8/src/java/io/OutputStream.java
new file mode 100644
index 0000000000..8d9756265b
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/OutputStream.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class OutputStream {
+
+ public void write(byte b[]) throws IOException {
+ }
+ public void flush() throws IOException {
+ }
+ public void close() throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/PrintStream.java b/JCL/converterJclMin1.8/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..503f080425
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/PrintStream.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintStream {
+
+ public void println() {
+ }
+
+ public void println(String s) {
+ }
+
+ public void println(int i) {
+ }
+
+ public void println(Object o) {
+ }
+
+ public void print(String s) {
+ }
+
+ public void print(Object o) {
+ }
+
+ public void print(int i) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/PrintWriter.java b/JCL/converterJclMin1.8/src/java/io/PrintWriter.java
new file mode 100644
index 0000000000..ec7e885e07
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/PrintWriter.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class PrintWriter extends Writer {
+ public PrintWriter(ByteArrayOutputStream stream) {
+ }
+ public PrintWriter(Writer w) {
+ }
+ public void print(String s) {
+ }
+ public void print(char[] tab) {
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+ public void println(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/Reader.java b/JCL/converterJclMin1.8/src/java/io/Reader.java
new file mode 100644
index 0000000000..bb74ec22fa
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/Reader.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class Reader {
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/Serializable.java b/JCL/converterJclMin1.8/src/java/io/Serializable.java
new file mode 100644
index 0000000000..e33731bec8
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/Serializable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public interface Serializable {
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/StringWriter.java b/JCL/converterJclMin1.8/src/java/io/StringWriter.java
new file mode 100644
index 0000000000..84631fdee0
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/StringWriter.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public class StringWriter extends Writer {
+
+ public StringBuffer getBuffer() {
+ return null;
+ }
+ public void flush() {
+ }
+ public void close() {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/UnsupportedEncodingException.java b/JCL/converterJclMin1.8/src/java/io/UnsupportedEncodingException.java
new file mode 100644
index 0000000000..6eb4f03784
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/UnsupportedEncodingException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+public class UnsupportedEncodingException extends IOException {
+ private static final long serialVersionUID = 1031403719398591519L;
+ public UnsupportedEncodingException(String s) {
+ super(s);
+ }
+ public UnsupportedEncodingException() {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/io/Writer.java b/JCL/converterJclMin1.8/src/java/io/Writer.java
new file mode 100644
index 0000000000..8a198ae50c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/io/Writer.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.io;
+
+
+public abstract class Writer {
+ public abstract void flush() throws IOException;
+ public abstract void close() throws IOException;
+ public void write(String str) throws IOException {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ArithmeticException.java b/JCL/converterJclMin1.8/src/java/lang/ArithmeticException.java
new file mode 100644
index 0000000000..afe937b4cd
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ArithmeticException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArithmeticException extends RuntimeException {
+ private static final long serialVersionUID = 7325899601264404083L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ArrayIndexOutOfBoundsException.java b/JCL/converterJclMin1.8/src/java/lang/ArrayIndexOutOfBoundsException.java
new file mode 100644
index 0000000000..3838011898
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ArrayIndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
+ private static final long serialVersionUID = -7035391738132728176L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/AssertionError.java b/JCL/converterJclMin1.8/src/java/lang/AssertionError.java
new file mode 100644
index 0000000000..30e69bcbb4
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/AssertionError.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class AssertionError extends Error {
+ private static final long serialVersionUID = 3910378697039934416L;
+ /**
+ * Constructor for AssertionError.
+ * @param s
+ */
+ public AssertionError(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for AssertionError.
+ */
+ public AssertionError() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/AutoCloseable.java b/JCL/converterJclMin1.8/src/java/lang/AutoCloseable.java
new file mode 100644
index 0000000000..b6fbe46773
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/AutoCloseable.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface AutoCloseable {
+ void close() throws Exception;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Boolean.java b/JCL/converterJclMin1.8/src/java/lang/Boolean.java
new file mode 100644
index 0000000000..198c9287b1
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Boolean.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Boolean {
+ public static final Boolean TRUE = new Boolean(true);
+ public static final Boolean FALSE = new Boolean(false);
+ public Boolean(boolean b) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Byte.java b/JCL/converterJclMin1.8/src/java/lang/Byte.java
new file mode 100644
index 0000000000..75c71a1c00
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Byte.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Byte extends Number implements Comparable<Byte> {
+ private static final long serialVersionUID = 8750891329089001085L;
+ public Byte(byte b) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Byte b) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Character.java b/JCL/converterJclMin1.8/src/java/lang/Character.java
new file mode 100644
index 0000000000..337c148689
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Character.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Character {
+ public Character(char c) {
+ }
+ public static char toLowerCase(char c) {
+ return ' ';
+ }
+
+ public static int getNumericValue(char c) {
+ return 0;
+ }
+
+ public static int digit(char ch, int radix) {
+ return 0;
+ }
+ public static boolean isWhitespace(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierStart(char c) {
+ return false;
+ }
+ public static boolean isJavaIdentifierPart(char c) {
+ return false;
+ }
+ public static boolean isDigit(char c) {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Class.java b/JCL/converterJclMin1.8/src/java/lang/Class.java
new file mode 100644
index 0000000000..7e82f809c8
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Class.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.InputStream;
+
+public class Class<T> {
+ public String getName() {
+ return null;
+ }
+ public InputStream getResourceAsStream(String s) {
+ return null;
+ }
+
+ public native Class<? super T> getSuperclass();
+
+ public T newInstance() throws InstantiationException, IllegalAccessException {
+ return null;
+ }
+
+ public static Class<?> forName(String className) throws ClassNotFoundException {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ClassCastException.java b/JCL/converterJclMin1.8/src/java/lang/ClassCastException.java
new file mode 100644
index 0000000000..72d6810139
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ClassCastException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ClassCastException extends RuntimeException {
+ private static final long serialVersionUID = -2824993730424549317L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin1.8/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..46742b7d4a
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class ClassNotFoundException extends Exception {
+ private static final long serialVersionUID = -7119744281167457228L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin1.8/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..5fb63b9ea1
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+ private static final long serialVersionUID = -3979306935580113776L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Cloneable.java b/JCL/converterJclMin1.8/src/java/lang/Cloneable.java
new file mode 100644
index 0000000000..bc1cb76200
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Cloneable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Cloneable {
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Comparable.java b/JCL/converterJclMin1.8/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..fae6b35eb2
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Comparable.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Comparable<T> {
+ public int compareTo(T o);
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Deprecated.java b/JCL/converterJclMin1.8/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..b065093472
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Deprecated.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.*;
+
+@Retention(RUNTIME)
+public @interface Deprecated {}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Double.java b/JCL/converterJclMin1.8/src/java/lang/Double.java
new file mode 100644
index 0000000000..18312efacb
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Double.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Double extends Number implements Comparable<Double> {
+ private static final long serialVersionUID = -5839202747810229696L;
+ public Double(double d) {
+ }
+ public static String toString(double d) {
+ return null;
+ }
+ public static Double valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final double POSITIVE_INFINITY = 1.0 / 0.0;
+ public static boolean isNaN(double v) {
+ return false;
+ }
+ public double doubleValue() {
+ return 0.0;
+ }
+ public static final double MAX_VALUE = 1.7976931348623157e+308;
+ public static final double MIN_VALUE = 4.9e-324;
+ public static final double NaN = 0.0d / 0.0;
+
+ public static native double longBitsToDouble(long bits);
+ public static native long doubleToLongBits(double value);
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+
+ public static double parseDouble(String s) {
+ return 0.0;
+ }
+ public int compareTo(Double d) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Enum.java b/JCL/converterJclMin1.8/src/java/lang/Enum.java
new file mode 100644
index 0000000000..13aba40055
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Enum.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>,
+ java.io.Serializable {
+
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+
+ public final String name() {
+ return null;
+ }
+
+ public final int ordinal() {
+ return 0;
+ }
+
+ public final int compareTo(T o) {
+ return 0;
+ }
+
+ public final Class<T> getDeclaringClass() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/Error.java b/JCL/converterJclMin1.8/src/java/lang/Error.java
new file mode 100644
index 0000000000..5b9b5435fd
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Error.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Error extends Throwable {
+ private static final long serialVersionUID = 9179125830904709243L;
+
+ public Error(String s) {
+ super(s);
+ }
+
+ public Error() {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Exception.java b/JCL/converterJclMin1.8/src/java/lang/Exception.java
new file mode 100644
index 0000000000..9580b40d76
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Exception.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Exception extends Throwable {
+ private static final long serialVersionUID = -3387516993124229948L;
+ public Exception() {
+ }
+ public Exception(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ExceptionInInitializerError.java b/JCL/converterJclMin1.8/src/java/lang/ExceptionInInitializerError.java
new file mode 100644
index 0000000000..2cf1e21702
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ExceptionInInitializerError.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class ExceptionInInitializerError extends Error {
+ private static final long serialVersionUID = 2267505642151644179L;
+
+ public ExceptionInInitializerError(String s) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Float.java b/JCL/converterJclMin1.8/src/java/lang/Float.java
new file mode 100644
index 0000000000..fd5313bde3
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Float.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Float extends Number implements Comparable<Float> {
+ private static final long serialVersionUID = -872370025937303716L;
+ public static final float NaN = 0.0f / 0.0f;
+ public Float(float f) {
+ }
+ public static native float intBitsToFloat(int bits);
+ public static Float valueOf(String s) throws NumberFormatException {
+ return null;
+ }
+ public static final float POSITIVE_INFINITY = 1.0f / 0.0f;
+ public static boolean isNaN(float v) {
+ return false;
+ }
+ public float floatValue() {
+ return 0.0f;
+ }
+ public static final float MAX_VALUE = 3.4028235e+38f;
+ public static final float MIN_VALUE = 1.4e-45f;
+ public static native int floatToIntBits(float value);
+ public static String toString(float f) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Float f) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin1.8/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..d07dbcff05
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalAccessException extends Exception {
+ private static final long serialVersionUID = 4022280013694488250L;
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin1.8/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..38ea0bfdc0
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+ private static final long serialVersionUID = 3460688064376288846L;
+ public IllegalMonitorStateException(String s) {
+ }
+ public IllegalMonitorStateException() {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/IndexOutOfBoundsException.java b/JCL/converterJclMin1.8/src/java/lang/IndexOutOfBoundsException.java
new file mode 100644
index 0000000000..32bbeb8747
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/IndexOutOfBoundsException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class IndexOutOfBoundsException extends RuntimeException {
+ private static final long serialVersionUID = 2192343167556759436L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/InstantiationException.java b/JCL/converterJclMin1.8/src/java/lang/InstantiationException.java
new file mode 100644
index 0000000000..cccda2332a
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/InstantiationException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InstantiationException extends Exception {
+ private static final long serialVersionUID = 6944714408584296262L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Integer.java b/JCL/converterJclMin1.8/src/java/lang/Integer.java
new file mode 100644
index 0000000000..5cdeb3415d
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Integer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Integer extends Number implements Comparable<Integer> {
+ private static final long serialVersionUID = 6462609062775655000L;
+
+ public Integer(int i) {
+ }
+ public Integer(String s) {
+ }
+ public static final int MAX_VALUE= 2147483647;
+ public static final int MIN_VALUE= -2147483647;
+
+ public static int parseInt(String s) throws NumberFormatException {
+ return 0;
+ }
+ public static String toHexString(int i) {
+ return null;
+ }
+ public static String toString(int i) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Integer i) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/InterruptedException.java b/JCL/converterJclMin1.8/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..52b67124d9
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/InterruptedException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class InterruptedException extends Exception {
+ private static final long serialVersionUID = 4024069220747256448L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Iterable.java b/JCL/converterJclMin1.8/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..9e1be1a38c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Iterable.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.util.Iterator;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Long.java b/JCL/converterJclMin1.8/src/java/lang/Long.java
new file mode 100644
index 0000000000..f5f7357ac1
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Long.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Long extends Number implements Comparable<Long> {
+ private static final long serialVersionUID = 7046418566711138668L;
+ public static final long MIN_VALUE = 0x8000000000000000L;
+ public static final long MAX_VALUE = 0x7fffffffffffffffL;
+ public Long(long l) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Long l) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Math.java b/JCL/converterJclMin1.8/src/java/lang/Math.java
new file mode 100644
index 0000000000..5183719463
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Math.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Math {
+
+ public static int min(int a, int b) {
+ return 0;
+ }
+ public static int max(int a, int b) {
+ return 0;
+ }
+ public static int abs(int a) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin1.8/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..a516033612
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,28 @@
+package java.lang;
+
+/**
+ * Thrown when a particular method cannot be found.
+ *
+ * @author unascribed
+ * @since JDK1.0
+ */
+public class NoSuchMethodException extends ReflectiveOperationException {
+ private static final long serialVersionUID = 5034388446362600923L;
+
+ /**
+ * Constructs a <code>NoSuchMethodException</code> without a detail message.
+ */
+ public NoSuchMethodException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>NoSuchMethodException</code> with a detail message.
+ *
+ * @param s
+ * the detail message.
+ */
+ public NoSuchMethodException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/NullPointerException.java b/JCL/converterJclMin1.8/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..6e9f4e1358
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/NullPointerException.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class NullPointerException extends RuntimeException {
+ private static final long serialVersionUID = -945245241303869636L;
+
+ /**
+ * Constructor for NullPointerException.
+ * @param s
+ */
+ public NullPointerException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructor for NullPointerException.
+ */
+ public NullPointerException() {
+ super();
+ }
+
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Number.java b/JCL/converterJclMin1.8/src/java/lang/Number.java
new file mode 100644
index 0000000000..c8ccd0833a
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Number.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public abstract class Number implements java.io.Serializable {
+ private static final long serialVersionUID = 3166984097235214156L;
+ public abstract int intValue();
+ public abstract long longValue();
+ public abstract float floatValue();
+ public abstract double doubleValue();
+ public byte byteValue() {
+ return (byte) intValue();
+ }
+ public short shortValue() {
+ return (short) intValue();
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/NumberFormatException.java b/JCL/converterJclMin1.8/src/java/lang/NumberFormatException.java
new file mode 100644
index 0000000000..eeb7eb737c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/NumberFormatException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class NumberFormatException extends RuntimeException {
+ private static final long serialVersionUID = 9070730590112500498L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Object.java b/JCL/converterJclMin1.8/src/java/lang/Object.java
new file mode 100644
index 0000000000..9ed67c1b01
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Object.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Object {
+
+ public Object() {
+ }
+ protected Object clone() throws CloneNotSupportedException {
+ return null;
+ }
+ public boolean equals(Object obj) {
+ return false;
+ }
+ protected void finalize() throws Throwable {
+ }
+ public final native Class<? extends Object> getClass();
+ public int hashCode() {
+ return -1;
+ }
+ public final void notify() throws IllegalMonitorStateException {
+ }
+ public final void notifyAll() throws IllegalMonitorStateException {
+ }
+ public String toString() {
+ return null;
+ }
+ public final void wait() throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis) throws IllegalMonitorStateException,
+ InterruptedException {
+ }
+ public final void wait(long millis, int nanos)
+ throws IllegalMonitorStateException, InterruptedException {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Override.java b/JCL/converterJclMin1.8/src/java/lang/Override.java
new file mode 100644
index 0000000000..e30eba7b6d
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Override.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+
+@Target(ElementType.METHOD) @Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin1.8/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 0000000000..46df5a4c81
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Runnable.java b/JCL/converterJclMin1.8/src/java/lang/Runnable.java
new file mode 100644
index 0000000000..d37f3130d1
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Runnable.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public interface Runnable {
+
+ void run();
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/RuntimeException.java b/JCL/converterJclMin1.8/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..6018b82614
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/RuntimeException.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class RuntimeException extends Exception {
+ private static final long serialVersionUID = -8038704779788883814L;
+ public RuntimeException(String s) {
+ super(s);
+ }
+ public RuntimeException() {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/SafeVarargs.java b/JCL/converterJclMin1.8/src/java/lang/SafeVarargs.java
new file mode 100644
index 0000000000..765dc3f57e
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/SafeVarargs.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.*;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RUNTIME)
+@Target({CONSTRUCTOR, METHOD})
+public @interface SafeVarargs {} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/Short.java b/JCL/converterJclMin1.8/src/java/lang/Short.java
new file mode 100644
index 0000000000..7c36571d45
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Short.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+
+public class Short extends Number implements Comparable<Short> {
+ private static final long serialVersionUID = -8044450932684282285L;
+ public Short(short s) {
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Short s) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/String.java b/JCL/converterJclMin1.8/src/java/lang/String.java
new file mode 100644
index 0000000000..27cd154400
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/String.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class String implements java.io.Serializable, Comparable<String> {
+ private static final long serialVersionUID = 1705120029863330869L;
+
+ public String() {
+ }
+ public String(char[] source) {
+ }
+ public String(String s) {
+ }
+ public String(char[] source, int i , int j) {
+ }
+ public int length() {
+ return 0;
+ }
+ public String replace(char oldChar, char newChar) {
+ return null;
+ }
+
+ public int lastIndexOf(char c) {
+ return 0;
+ }
+
+ public String substring(int i, int j) {
+ return null;
+ }
+ public String substring(int i) {
+ return null;
+ }
+ public char[] toCharArray() {
+ return null;
+ }
+ public int indexOf(String s) {
+ return 0;
+ }
+ public int indexOf(String s, int i) {
+ return 0;
+ }
+ public boolean endsWith(String s) {
+ return false;
+ }
+ public static String valueOf(int i) {
+ return null;
+ }
+ public static String valueOf(Object o) {
+ return null;
+ }
+ public static String valueOf(char[] tab) {
+ return null;
+ }
+ public static String valueOf(char[] tab, int i, int j) {
+ return null;
+ }
+ public int compareTo(String s) {
+ return 0;
+ }
+ public int indexOf(int ch, int fromIndex) {
+ return 0;
+ }
+ public char charAt(int i) {
+ return ' ';
+ }
+ public String trim() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/StringBuffer.java b/JCL/converterJclMin1.8/src/java/lang/StringBuffer.java
new file mode 100644
index 0000000000..f77dd695b0
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/StringBuffer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class StringBuffer {
+ public StringBuffer() {
+ }
+ public StringBuffer(String s) {
+ }
+ public StringBuffer(int i) {
+ }
+ public synchronized StringBuffer insert(int offset, String str) {
+ return this;
+ }
+ public synchronized StringBuffer append(String s) {
+ return this;
+ }
+ public synchronized StringBuffer append(StringBuffer buffer) {
+ return this;
+ }
+ public synchronized StringBuffer append(boolean b) {
+ return this;
+ }
+ public synchronized StringBuffer append(int i) {
+ return this;
+ }
+ public synchronized StringBuffer append(long l) {
+ return this;
+ }
+ public synchronized StringBuffer append(float f) {
+ return this;
+ }
+ public synchronized StringBuffer append(double d) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o) {
+ return this;
+ }
+ public synchronized StringBuffer append(char[] o, int i, int j) {
+ return this;
+ }
+ public synchronized StringBuffer append(Object o) {
+ return this;
+ }
+ public int length() {
+ return 0;
+ }
+ public char[] getChars(int i, int j, char[] tab, int k) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/SuppressWarnings.java b/JCL/converterJclMin1.8/src/java/lang/SuppressWarnings.java
new file mode 100644
index 0000000000..7aa7548f57
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/SuppressWarnings.java
@@ -0,0 +1,11 @@
+package java.lang;
+
+import static java.lang.annotation.ElementType.*;
+
+import java.lang.annotation.*;
+
+@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface SuppressWarnings {
+ String[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/System.java b/JCL/converterJclMin1.8/src/java/lang/System.java
new file mode 100644
index 0000000000..a13acd2404
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/System.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+
+public class System {
+
+ public static PrintStream err;
+ public static PrintStream out;
+
+ public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
+ public static String getProperty(String s) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Throwable.java b/JCL/converterJclMin1.8/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..55be032fdf
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Throwable.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+import java.io.PrintStream;
+import java.io.Serializable;
+import java.io.Writer;
+
+public class Throwable implements Serializable {
+ private static final long serialVersionUID = -282116690407747101L;
+ public Throwable(String s) {
+ }
+ public Throwable() {
+ }
+
+ public void printStackTrace() {
+ }
+
+ public void printStackTrace(Writer w) {
+ }
+
+ public void printStackTrace(PrintStream w) {
+ }
+ public String getMessage() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/Void.java b/JCL/converterJclMin1.8/src/java/lang/Void.java
new file mode 100644
index 0000000000..72e9ca2bec
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/Void.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Void {} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin1.8/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..f6dbed6917
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public interface Annotation {
+ boolean equals(Object obj);
+
+ int hashCode();
+
+ String toString();
+
+ Class<? extends Annotation> annotationType();
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/annotation/Documented.java b/JCL/converterJclMin1.8/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..1826f297a1
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/annotation/Documented.java
@@ -0,0 +1,10 @@
+package java.lang.annotation;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+@Documented
+@Retention(RUNTIME)
+@Target(ANNOTATION_TYPE)
+public @interface Documented {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin1.8/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..efd97459fb
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public enum ElementType {
+ TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE, TYPE_USE, TYPE_PARAMETER,
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/annotation/Retention.java b/JCL/converterJclMin1.8/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..b51bfad6a7
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/annotation/Retention.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin1.8/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..cbd3bfcc5c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+public enum RetentionPolicy {
+ SOURCE, CLASS, RUNTIME
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/annotation/Target.java b/JCL/converterJclMin1.8/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..bdfbeebd39
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/annotation/Target.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.annotation;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/invoke/LambdaMetafactory.java b/JCL/converterJclMin1.8/src/java/lang/invoke/LambdaMetafactory.java
new file mode 100644
index 0000000000..91c66f2ef9
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/invoke/LambdaMetafactory.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.invoke;
+
+public class LambdaMetafactory {
+
+ public static final int FLAG_SERIALIZABLE = 1 << 0;
+
+ public static final int FLAG_MARKERS = 1 << 1;
+
+ public static CallSite metaFactory(MethodHandles.Lookup caller,
+ String invokedName,
+ MethodType invokedType,
+ MethodHandle samMethod,
+ MethodHandle implMethod,
+ MethodType instantiatedMethodType) {
+ return null;
+ }
+
+ public static CallSite altMetaFactory(MethodHandles.Lookup caller,
+ String invokedName,
+ MethodType invokedType,
+ Object... args) {
+ return null;
+ }
+}
+
diff --git a/JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..b702132820
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.invoke;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin1.8/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..067d5f9db0
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,16 @@
+package java.lang.invoke;
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ref/Reference.java b/JCL/converterJclMin1.8/src/java/lang/ref/Reference.java
new file mode 100644
index 0000000000..4d163a8bd1
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ref/Reference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class Reference {
+ public Object get() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ref/ReferenceQueue.java b/JCL/converterJclMin1.8/src/java/lang/ref/ReferenceQueue.java
new file mode 100644
index 0000000000..9fe70bdafe
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ref/ReferenceQueue.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+public class ReferenceQueue {
+ public Reference poll() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/lang/ref/WeakReference.java b/JCL/converterJclMin1.8/src/java/lang/ref/WeakReference.java
new file mode 100644
index 0000000000..a45438ab53
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/lang/ref/WeakReference.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang.ref;
+
+
+public class WeakReference extends Reference {
+ public WeakReference(Object o, ReferenceQueue queue) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/net/MalformedURLException.java b/JCL/converterJclMin1.8/src/java/net/MalformedURLException.java
new file mode 100644
index 0000000000..3c31ec74fe
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/net/MalformedURLException.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.net;
+
+public class MalformedURLException extends Exception {
+ private static final long serialVersionUID = -465098896288949281L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/text/NumberFormat.java b/JCL/converterJclMin1.8/src/java/text/NumberFormat.java
new file mode 100644
index 0000000000..93a29b63cf
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/text/NumberFormat.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.text;
+
+public class NumberFormat {
+
+ public final static NumberFormat getInstance() {
+ return null;
+ }
+
+ public final String format (double d) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/AbstractCollection.java b/JCL/converterJclMin1.8/src/java/util/AbstractCollection.java
new file mode 100644
index 0000000000..89e6b86afe
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/AbstractCollection.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractCollection<E> implements Collection<E> {
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/AbstractList.java b/JCL/converterJclMin1.8/src/java/util/AbstractList.java
new file mode 100644
index 0000000000..ab84c73f8a
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/AbstractList.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractList<E> extends AbstractCollection<E> implements List<E> {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/util/AbstractSet.java b/JCL/converterJclMin1.8/src/java/util/AbstractSet.java
new file mode 100644
index 0000000000..c93ad94dad
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/AbstractSet.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public abstract class AbstractSet<E> extends AbstractCollection<E> implements Set<E> {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/util/ArrayList.java b/JCL/converterJclMin1.8/src/java/util/ArrayList.java
new file mode 100644
index 0000000000..7b76b91727
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/ArrayList.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+import java.io.Serializable;
+
+public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable {
+ private static final long serialVersionUID = -2169998406647523911L;
+ public ArrayList(int i) {
+ }
+ public ArrayList() {
+ }
+ public <T> T[] toArray(T[] o) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public boolean add(E o) {
+ return false;
+ }
+ public int indexOf(E o) {
+ return 0;
+ }
+ public E remove(int index) {
+ return null;
+ }
+ public E get(int index) {
+ return null;
+ }
+ public boolean contains(E o) {
+ return false;
+ }
+ public Iterator<E> iterator() {
+ return null;
+ }
+ public boolean addAll(Collection<E> c) {
+ return false;
+ }
+ public void set(int i, E o) {
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Arrays.java b/JCL/converterJclMin1.8/src/java/util/Arrays.java
new file mode 100644
index 0000000000..3fe9c6f924
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Arrays.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class Arrays {
+ public static void sort(Object[] tab) {
+ }
+ @SafeVarargs
+ public static <T> List<T> asList(T... a) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Collection.java b/JCL/converterJclMin1.8/src/java/util/Collection.java
new file mode 100644
index 0000000000..9074dea074
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Collection.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Collection<E> extends Iterable<E> {
+ public Iterator<E> iterator();
+ public int size();
+ public E get(int index);
+ public boolean addAll(Collection<E> c);
+ public <T> T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Collections.java b/JCL/converterJclMin1.8/src/java/util/Collections.java
new file mode 100644
index 0000000000..fa2220d3ce
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Collections.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Collections {
+ public static <T extends Comparable<? super T>> void sort(List<T> list) {
+ }
+
+ public static final <K,V> Map<K,V> emptyMap() {
+ return null;
+ }
+ public static final <T> List<T> emptyList() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Enumeration.java b/JCL/converterJclMin1.8/src/java/util/Enumeration.java
new file mode 100644
index 0000000000..71ce4fb586
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Enumeration.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Enumeration {
+
+ public boolean hasMoreElements();
+
+ public Object nextElement();
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/HashMap.java b/JCL/converterJclMin1.8/src/java/util/HashMap.java
new file mode 100644
index 0000000000..d22a3176c5
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/HashMap.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class HashMap<K,V> implements Map<K,V> {
+ public HashMap(int i) {
+ }
+ public V get(K k) {
+ return null;
+ }
+ public boolean containsKey(K k) {
+ return false;
+ }
+ public void put(K k, V v) {
+ }
+ public int size() {
+ return 0;
+ }
+ public Set<K> keySet() {
+ return null;
+ }
+ public Collection<V> values() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/HashSet.java b/JCL/converterJclMin1.8/src/java/util/HashSet.java
new file mode 100644
index 0000000000..6b29bc41e4
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/HashSet.java
@@ -0,0 +1,22 @@
+package java.util;
+
+import java.io.Serializable;
+
+public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, Serializable {
+ private static final long serialVersionUID = 4886489800857586866L;
+ public Iterator<E> iterator() {
+ return null;
+ }
+ public boolean addAll(Collection<E> c) {
+ return false;
+ }
+ public E get(int index) {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public <T> T[] toArray(T[] o) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Hashtable.java b/JCL/converterJclMin1.8/src/java/util/Hashtable.java
new file mode 100644
index 0000000000..fc2c5eb10f
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Hashtable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Hashtable<U, V> implements Map<U, V> {
+ public Hashtable(int i) {
+ }
+ public V get(U u) {
+ return null;
+ }
+ public boolean containsKey(U u) {
+ return false;
+ }
+ public void put(U u, V v) {
+ }
+ public synchronized Enumeration elements() {
+ return null;
+ }
+ public int size() {
+ return 0;
+ }
+ public synchronized Enumeration keys() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Iterator.java b/JCL/converterJclMin1.8/src/java/util/Iterator.java
new file mode 100644
index 0000000000..1356cd55a2
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Iterator.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/List.java b/JCL/converterJclMin1.8/src/java/util/List.java
new file mode 100644
index 0000000000..8039b14743
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/List.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface List<T> extends Collection<T> {
+ public boolean add(T o);
+ public void set(int i, T o);
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Locale.java b/JCL/converterJclMin1.8/src/java/util/Locale.java
new file mode 100644
index 0000000000..d591b3946a
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Locale.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Locale {
+ public static Locale getDefault() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Map.java b/JCL/converterJclMin1.8/src/java/util/Map.java
new file mode 100644
index 0000000000..fc06d3cece
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Map.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public interface Map<K,V> {
+
+ public V get(K k);
+ public boolean containsKey(K k);
+ public void put(K k, V v);
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/MissingResourceException.java b/JCL/converterJclMin1.8/src/java/util/MissingResourceException.java
new file mode 100644
index 0000000000..3f512497f5
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/MissingResourceException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class MissingResourceException extends RuntimeException {
+ private static final long serialVersionUID = -6463093713113089678L;
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/NoSuchElementException.java b/JCL/converterJclMin1.8/src/java/util/NoSuchElementException.java
new file mode 100644
index 0000000000..855fa6ae99
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/NoSuchElementException.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public class NoSuchElementException extends RuntimeException {
+ private static final long serialVersionUID = -3741760439480852710L;
+} \ No newline at end of file
diff --git a/JCL/converterJclMin1.8/src/java/util/RandomAccess.java b/JCL/converterJclMin1.8/src/java/util/RandomAccess.java
new file mode 100644
index 0000000000..78870df3a5
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/RandomAccess.java
@@ -0,0 +1,3 @@
+package java.util;
+
+public interface RandomAccess {}
diff --git a/JCL/converterJclMin1.8/src/java/util/ResourceBundle.java b/JCL/converterJclMin1.8/src/java/util/ResourceBundle.java
new file mode 100644
index 0000000000..027b99f365
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/ResourceBundle.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public abstract class ResourceBundle {
+
+ public static final ResourceBundle getBundle(String baseName, Locale locale) {
+ return null;
+ }
+
+ public final String getString(String key) {
+ return null;
+ }
+ public abstract Enumeration getKeys();
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Set.java b/JCL/converterJclMin1.8/src/java/util/Set.java
new file mode 100644
index 0000000000..64284b40a8
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Set.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+
+public interface Set<U> extends Collection<U> {
+ public Iterator<U> iterator();
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/StringTokenizer.java b/JCL/converterJclMin1.8/src/java/util/StringTokenizer.java
new file mode 100644
index 0000000000..86214d8596
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/StringTokenizer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class StringTokenizer {
+
+ public StringTokenizer(String toBeParsed, String delimiters) {
+ }
+
+ public int countTokens() {
+ return 0;
+ }
+
+ public String nextToken() {
+ return null;
+ }
+
+ public boolean hasMoreTokens() {
+ return false;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/Vector.java b/JCL/converterJclMin1.8/src/java/util/Vector.java
new file mode 100644
index 0000000000..7f8630a58c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/Vector.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util;
+
+public class Vector<E> {
+
+ public Vector() {
+ }
+
+ public Vector(int i) {
+ }
+
+ public int size() {
+ return 0;
+ }
+
+ public E get(int i) {
+ return null;
+ }
+
+ public boolean add(E o) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/zip/ZipEntry.java b/JCL/converterJclMin1.8/src/java/util/zip/ZipEntry.java
new file mode 100644
index 0000000000..7c82b06d8c
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/zip/ZipEntry.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+
+public class ZipEntry {
+ public long getSize() {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin1.8/src/java/util/zip/ZipFile.java b/JCL/converterJclMin1.8/src/java/util/zip/ZipFile.java
new file mode 100644
index 0000000000..56c853a2bc
--- /dev/null
+++ b/JCL/converterJclMin1.8/src/java/util/zip/ZipFile.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.util.zip;
+
+import java.io.InputStream;
+
+
+public class ZipFile {
+ public ZipEntry getEntry(String s) {
+ return null;
+ }
+ public InputStream getInputStream(ZipEntry zipEntry) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin10/.classpath b/JCL/converterJclMin10/.classpath
new file mode 100644
index 0000000000..6df3186bde
--- /dev/null
+++ b/JCL/converterJclMin10/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin10/.project b/JCL/converterJclMin10/.project
new file mode 100644
index 0000000000..a6fd02cfc6
--- /dev/null
+++ b/JCL/converterJclMin10/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin10</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin10/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin10/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..a15d78d331
--- /dev/null
+++ b/JCL/converterJclMin10/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,15 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=10
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=10
diff --git a/JCL/converterJclMin10/src/java/io/Serializable.java b/JCL/converterJclMin10/src/java/io/Serializable.java
new file mode 100644
index 0000000000..3629567396
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/CharSequence.java b/JCL/converterJclMin10/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b03fc9e823
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin10/src/java/lang/Class.java b/JCL/converterJclMin10/src/java/lang/Class.java
new file mode 100644
index 0000000000..7d08bf1f38
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin10/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..6f05a932fa
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/Comparable.java b/JCL/converterJclMin10/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..59fb9eddd4
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/Deprecated.java b/JCL/converterJclMin10/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..5226e586c7
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/Enum.java b/JCL/converterJclMin10/src/java/lang/Enum.java
new file mode 100644
index 0000000000..d95e7ae4d4
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/Error.java b/JCL/converterJclMin10/src/java/lang/Error.java
new file mode 100644
index 0000000000..02f4405bde
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Error.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Error extends Throwable {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/Exception.java b/JCL/converterJclMin10/src/java/lang/Exception.java
new file mode 100644
index 0000000000..6e3cf321f9
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Exception.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Exception extends Throwable {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin10/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..0d13e1e057
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin10/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin10/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..1f67418128
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/InterruptedException.java b/JCL/converterJclMin10/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..93b236c421
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin10/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..3dd142bdd3
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin10/src/java/lang/Object.java b/JCL/converterJclMin10/src/java/lang/Object.java
new file mode 100644
index 0000000000..71ddb4ff83
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin10/src/java/lang/RuntimeException.java b/JCL/converterJclMin10/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..3be7f777cc
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/RuntimeException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/String.java b/JCL/converterJclMin10/src/java/lang/String.java
new file mode 100644
index 0000000000..38fc3e31f3
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/String.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+}
diff --git a/JCL/converterJclMin10/src/java/lang/Throwable.java b/JCL/converterJclMin10/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..031917ca53
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/Throwable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Throwable {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin10/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..530c272ea4
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/Documented.java b/JCL/converterJclMin10/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..840d0f454e
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/Documented.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin10/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..b6dd0f6d5d
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+public enum ElementType {
+ ANNOTATION_TYPE,
+ CONSTRUCTOR,
+ FIELD,
+ LOCAL_VARIABLE,
+ METHOD,
+ PACKAGE,
+ PARAMETER,
+ TYPE,
+ TYPE_USE,
+ TYPE_PARAMETER,
+}
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin10/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..ed69c0b04e
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/Retention.java b/JCL/converterJclMin10/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..25e8ba7396
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/Retention.java
@@ -0,0 +1,8 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin10/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..26349b1919
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/annotation/Target.java b/JCL/converterJclMin10/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..3ee9c31f48
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/annotation/Target.java
@@ -0,0 +1,8 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin10/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..8a1fdd030e
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,38 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin10/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin10/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin10/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..90a46dc8fe
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin10/src/java/util/Collection.java b/JCL/converterJclMin10/src/java/util/Collection.java
new file mode 100644
index 0000000000..c04e2cd1ff
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin10/src/java/util/Iterator.java b/JCL/converterJclMin10/src/java/util/Iterator.java
new file mode 100644
index 0000000000..ae53f8408e
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin10/src/java/util/List.java b/JCL/converterJclMin10/src/java/util/List.java
new file mode 100644
index 0000000000..4565ccb902
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin10/src/java/util/Map.java b/JCL/converterJclMin10/src/java/util/Map.java
new file mode 100644
index 0000000000..f47752cfdb
--- /dev/null
+++ b/JCL/converterJclMin10/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin10/src/module-info.java b/JCL/converterJclMin10/src/module-info.java
new file mode 100644
index 0000000000..13fd25e6b0
--- /dev/null
+++ b/JCL/converterJclMin10/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+}
diff --git a/JCL/converterJclMin11/.classpath b/JCL/converterJclMin11/.classpath
new file mode 100644
index 0000000000..d54800d3c9
--- /dev/null
+++ b/JCL/converterJclMin11/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin11/.project b/JCL/converterJclMin11/.project
new file mode 100644
index 0000000000..b5c0038b02
--- /dev/null
+++ b/JCL/converterJclMin11/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin11</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin11/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin11/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..cd8d089a19
--- /dev/null
+++ b/JCL/converterJclMin11/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,15 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=11
diff --git a/JCL/converterJclMin11/src/java/io/Serializable.java b/JCL/converterJclMin11/src/java/io/Serializable.java
new file mode 100644
index 0000000000..3629567396
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/CharSequence.java b/JCL/converterJclMin11/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b03fc9e823
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin11/src/java/lang/Class.java b/JCL/converterJclMin11/src/java/lang/Class.java
new file mode 100644
index 0000000000..7d08bf1f38
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin11/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..6f05a932fa
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/Comparable.java b/JCL/converterJclMin11/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..59fb9eddd4
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/Deprecated.java b/JCL/converterJclMin11/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..5226e586c7
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/Enum.java b/JCL/converterJclMin11/src/java/lang/Enum.java
new file mode 100644
index 0000000000..d95e7ae4d4
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/Error.java b/JCL/converterJclMin11/src/java/lang/Error.java
new file mode 100644
index 0000000000..02f4405bde
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Error.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Error extends Throwable {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/Exception.java b/JCL/converterJclMin11/src/java/lang/Exception.java
new file mode 100644
index 0000000000..6e3cf321f9
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Exception.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Exception extends Throwable {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin11/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..0d13e1e057
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin11/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin11/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..1f67418128
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/InterruptedException.java b/JCL/converterJclMin11/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..93b236c421
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin11/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..3dd142bdd3
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin11/src/java/lang/Object.java b/JCL/converterJclMin11/src/java/lang/Object.java
new file mode 100644
index 0000000000..71ddb4ff83
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin11/src/java/lang/RuntimeException.java b/JCL/converterJclMin11/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..3be7f777cc
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/RuntimeException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/String.java b/JCL/converterJclMin11/src/java/lang/String.java
new file mode 100644
index 0000000000..38fc3e31f3
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/String.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+}
diff --git a/JCL/converterJclMin11/src/java/lang/Throwable.java b/JCL/converterJclMin11/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..031917ca53
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/Throwable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Throwable {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin11/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..530c272ea4
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/Documented.java b/JCL/converterJclMin11/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..840d0f454e
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/Documented.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin11/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..b6dd0f6d5d
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+public enum ElementType {
+ ANNOTATION_TYPE,
+ CONSTRUCTOR,
+ FIELD,
+ LOCAL_VARIABLE,
+ METHOD,
+ PACKAGE,
+ PARAMETER,
+ TYPE,
+ TYPE_USE,
+ TYPE_PARAMETER,
+}
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin11/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..ed69c0b04e
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/Retention.java b/JCL/converterJclMin11/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..b635cccb97
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/Retention.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin11/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..26349b1919
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/annotation/Target.java b/JCL/converterJclMin11/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..fcf6f550ad
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/annotation/Target.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin11/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..8a1fdd030e
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,38 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin11/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin11/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin11/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..90a46dc8fe
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin11/src/java/util/Collection.java b/JCL/converterJclMin11/src/java/util/Collection.java
new file mode 100644
index 0000000000..c04e2cd1ff
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin11/src/java/util/Iterator.java b/JCL/converterJclMin11/src/java/util/Iterator.java
new file mode 100644
index 0000000000..ae53f8408e
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin11/src/java/util/List.java b/JCL/converterJclMin11/src/java/util/List.java
new file mode 100644
index 0000000000..4565ccb902
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin11/src/java/util/Map.java b/JCL/converterJclMin11/src/java/util/Map.java
new file mode 100644
index 0000000000..f47752cfdb
--- /dev/null
+++ b/JCL/converterJclMin11/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin11/src/module-info.java b/JCL/converterJclMin11/src/module-info.java
new file mode 100644
index 0000000000..13fd25e6b0
--- /dev/null
+++ b/JCL/converterJclMin11/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+}
diff --git a/JCL/converterJclMin12/.classpath b/JCL/converterJclMin12/.classpath
new file mode 100644
index 0000000000..c0f260fb4c
--- /dev/null
+++ b/JCL/converterJclMin12/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin12/.project b/JCL/converterJclMin12/.project
new file mode 100644
index 0000000000..9b3b2412ec
--- /dev/null
+++ b/JCL/converterJclMin12/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin12</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin12/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin12/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..71f736ff9f
--- /dev/null
+++ b/JCL/converterJclMin12/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,14 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=12
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=12
diff --git a/JCL/converterJclMin12/src/java/io/Serializable.java b/JCL/converterJclMin12/src/java/io/Serializable.java
new file mode 100644
index 0000000000..3629567396
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/CharSequence.java b/JCL/converterJclMin12/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b03fc9e823
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin12/src/java/lang/Class.java b/JCL/converterJclMin12/src/java/lang/Class.java
new file mode 100644
index 0000000000..7d08bf1f38
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin12/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..6f05a932fa
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/Comparable.java b/JCL/converterJclMin12/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..59fb9eddd4
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/Deprecated.java b/JCL/converterJclMin12/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..5226e586c7
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/Enum.java b/JCL/converterJclMin12/src/java/lang/Enum.java
new file mode 100644
index 0000000000..d95e7ae4d4
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/Error.java b/JCL/converterJclMin12/src/java/lang/Error.java
new file mode 100644
index 0000000000..02f4405bde
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Error.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Error extends Throwable {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/Exception.java b/JCL/converterJclMin12/src/java/lang/Exception.java
new file mode 100644
index 0000000000..6e3cf321f9
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Exception.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Exception extends Throwable {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin12/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..0d13e1e057
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin12/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin12/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..1f67418128
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/InterruptedException.java b/JCL/converterJclMin12/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..93b236c421
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin12/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..3dd142bdd3
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin12/src/java/lang/Object.java b/JCL/converterJclMin12/src/java/lang/Object.java
new file mode 100644
index 0000000000..71ddb4ff83
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin12/src/java/lang/RuntimeException.java b/JCL/converterJclMin12/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..3be7f777cc
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/RuntimeException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/String.java b/JCL/converterJclMin12/src/java/lang/String.java
new file mode 100644
index 0000000000..38fc3e31f3
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/String.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+}
diff --git a/JCL/converterJclMin12/src/java/lang/Throwable.java b/JCL/converterJclMin12/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..031917ca53
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/Throwable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Throwable {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin12/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..530c272ea4
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/Documented.java b/JCL/converterJclMin12/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..840d0f454e
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/Documented.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin12/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..b6dd0f6d5d
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+public enum ElementType {
+ ANNOTATION_TYPE,
+ CONSTRUCTOR,
+ FIELD,
+ LOCAL_VARIABLE,
+ METHOD,
+ PACKAGE,
+ PARAMETER,
+ TYPE,
+ TYPE_USE,
+ TYPE_PARAMETER,
+}
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin12/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..ed69c0b04e
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/Retention.java b/JCL/converterJclMin12/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..b635cccb97
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/Retention.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin12/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..26349b1919
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/annotation/Target.java b/JCL/converterJclMin12/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..fcf6f550ad
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/annotation/Target.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin12/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..8a1fdd030e
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,38 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin12/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin12/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin12/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..90a46dc8fe
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin12/src/java/util/Collection.java b/JCL/converterJclMin12/src/java/util/Collection.java
new file mode 100644
index 0000000000..c04e2cd1ff
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin12/src/java/util/Iterator.java b/JCL/converterJclMin12/src/java/util/Iterator.java
new file mode 100644
index 0000000000..ae53f8408e
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin12/src/java/util/List.java b/JCL/converterJclMin12/src/java/util/List.java
new file mode 100644
index 0000000000..4565ccb902
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin12/src/java/util/Map.java b/JCL/converterJclMin12/src/java/util/Map.java
new file mode 100644
index 0000000000..f47752cfdb
--- /dev/null
+++ b/JCL/converterJclMin12/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin12/src/module-info.java b/JCL/converterJclMin12/src/module-info.java
new file mode 100644
index 0000000000..13fd25e6b0
--- /dev/null
+++ b/JCL/converterJclMin12/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+}
diff --git a/JCL/converterJclMin13/.classpath b/JCL/converterJclMin13/.classpath
new file mode 100644
index 0000000000..038a0e7bc9
--- /dev/null
+++ b/JCL/converterJclMin13/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-13">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin13/.project b/JCL/converterJclMin13/.project
new file mode 100644
index 0000000000..b3288f08cf
--- /dev/null
+++ b/JCL/converterJclMin13/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin13</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin13/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin13/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..ef28d2be0e
--- /dev/null
+++ b/JCL/converterJclMin13/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,14 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=13
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=13
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=13
diff --git a/JCL/converterJclMin13/src/META-INF/MANIFEST.MF b/JCL/converterJclMin13/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c72a1fbae7
--- /dev/null
+++ b/JCL/converterJclMin13/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 1.8.0_151 (Oracle Corporation)
+
diff --git a/JCL/converterJclMin13/src/java/io/InputStream.java b/JCL/converterJclMin13/src/java/io/InputStream.java
new file mode 100644
index 0000000000..82511babed
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/io/InputStream.java
@@ -0,0 +1,5 @@
+package java.io;
+
+public class InputStream {
+
+}
diff --git a/JCL/converterJclMin13/src/java/io/PrintStream.java b/JCL/converterJclMin13/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..19059381a2
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/io/PrintStream.java
@@ -0,0 +1,8 @@
+package java.io;
+
+public class PrintStream {
+ public void println(String x) {
+ }
+ public void println(int x) {
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/io/Serializable.java b/JCL/converterJclMin13/src/java/io/Serializable.java
new file mode 100644
index 0000000000..3629567396
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/CharSequence.java b/JCL/converterJclMin13/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b03fc9e823
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin13/src/java/lang/Class.java b/JCL/converterJclMin13/src/java/lang/Class.java
new file mode 100644
index 0000000000..7d08bf1f38
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin13/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..7765ed820a
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class ClassNotFoundException extends ReflectiveOperationException {
+
+ public ClassNotFoundException() {
+ super((Throwable)null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s) {
+ super(s, null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s, Throwable ex) {
+ super(s, ex); // Disallow initCause
+ }
+
+ public Throwable getException() {
+ return getCause();
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin13/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..6f05a932fa
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/Comparable.java b/JCL/converterJclMin13/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..59fb9eddd4
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/Deprecated.java b/JCL/converterJclMin13/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..5226e586c7
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/Enum.java b/JCL/converterJclMin13/src/java/lang/Enum.java
new file mode 100644
index 0000000000..d95e7ae4d4
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/Error.java b/JCL/converterJclMin13/src/java/lang/Error.java
new file mode 100644
index 0000000000..820d8c6222
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Error.java
@@ -0,0 +1,16 @@
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error(java.lang.String s, java.lang.Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/Exception.java b/JCL/converterJclMin13/src/java/lang/Exception.java
new file mode 100644
index 0000000000..88b222a9c0
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ super();
+ }
+
+ public Exception(String message) {
+ super(message);
+ }
+
+ public Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Exception(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin13/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..0d13e1e057
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin13/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin13/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..1f67418128
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/IncompatibleClassChangeError.java b/JCL/converterJclMin13/src/java/lang/IncompatibleClassChangeError.java
new file mode 100644
index 0000000000..9552b875b8
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/IncompatibleClassChangeError.java
@@ -0,0 +1,13 @@
+
+package java.lang;
+public
+class IncompatibleClassChangeError extends LinkageError {
+
+ public IncompatibleClassChangeError () {
+ super();
+ }
+
+ public IncompatibleClassChangeError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/InterruptedException.java b/JCL/converterJclMin13/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..93b236c421
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/Iterable.java b/JCL/converterJclMin13/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..ab4b9d53f6
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Iterable.java
@@ -0,0 +1,10 @@
+package java.lang;
+
+import java.util.Iterator;
+import java.util.function.Consumer;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+ default void forEach(Consumer<? super T> action) {
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/LinkageError.java b/JCL/converterJclMin13/src/java/lang/LinkageError.java
new file mode 100644
index 0000000000..199d39d98b
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/LinkageError.java
@@ -0,0 +1,17 @@
+package java.lang;
+
+public
+class LinkageError extends Error {
+
+ public LinkageError() {
+ super();
+ }
+
+ public LinkageError(String s) {
+ super(s);
+ }
+
+ public LinkageError(String s, Throwable cause) {
+ super(s, cause);
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/NoClassDefFoundError.java b/JCL/converterJclMin13/src/java/lang/NoClassDefFoundError.java
new file mode 100644
index 0000000000..da0fe415c3
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/NoClassDefFoundError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoClassDefFoundError extends LinkageError {
+
+ public NoClassDefFoundError() {
+ super();
+ }
+
+ public NoClassDefFoundError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin13/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 0000000000..486e5339dc
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoSuchFieldError extends IncompatibleClassChangeError {
+
+ public NoSuchFieldError() {
+ super();
+ }
+
+ public NoSuchFieldError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin13/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..3dd142bdd3
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin13/src/java/lang/NullPointerException.java b/JCL/converterJclMin13/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..5e4ffa680d
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/NullPointerException.java
@@ -0,0 +1,11 @@
+package java.lang;
+public
+class NullPointerException extends RuntimeException {
+ public NullPointerException() {
+ super();
+ }
+
+ public NullPointerException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/Object.java b/JCL/converterJclMin13/src/java/lang/Object.java
new file mode 100644
index 0000000000..71ddb4ff83
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin13/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin13/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 0000000000..0860c67905
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,26 @@
+
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+
+ public ReflectiveOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ReflectiveOperationException(Throwable cause) {
+ super(cause);
+ }
+
+ public java.lang.Throwable getCause() {
+ return getCause();
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/RuntimeException.java b/JCL/converterJclMin13/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..3d94712d7f
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/RuntimeException.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+
+ public RuntimeException(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public RuntimeException() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/String.java b/JCL/converterJclMin13/src/java/lang/String.java
new file mode 100644
index 0000000000..64f759b78b
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/String.java
@@ -0,0 +1,8 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+ public int codePointAt(int index) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/System.java b/JCL/converterJclMin13/src/java/lang/System.java
new file mode 100644
index 0000000000..bf56c93aa2
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/System.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+public final class System {
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ private System() {
+ }
+
+ public static final InputStream in = null;
+
+ public static final PrintStream out = null;
+
+
+}
diff --git a/JCL/converterJclMin13/src/java/lang/Throwable.java b/JCL/converterJclMin13/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..73ab84b695
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/Throwable.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class Throwable {
+
+ public Throwable(java.lang.String message) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(java.lang.String message, Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin13/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..530c272ea4
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/Documented.java b/JCL/converterJclMin13/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..840d0f454e
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/Documented.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin13/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..7b5b59578e
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,48 @@
+package java.lang.annotation;
+
+public enum ElementType {
+ /** Class, interface (including annotation type), or enum declaration */
+ TYPE,
+
+ /** Field declaration (includes enum constants) */
+ FIELD,
+
+ /** Method declaration */
+ METHOD,
+
+ /** Formal parameter declaration */
+ PARAMETER,
+
+ /** Constructor declaration */
+ CONSTRUCTOR,
+
+ /** Local variable declaration */
+ LOCAL_VARIABLE,
+
+ /** Annotation type declaration */
+ ANNOTATION_TYPE,
+
+ /** Package declaration */
+ PACKAGE,
+
+ /**
+ * Type parameter declaration
+ *
+ * @since 1.8
+ */
+ TYPE_PARAMETER,
+
+ /**
+ * Use of a type
+ *
+ * @since 1.8
+ */
+ TYPE_USE,
+
+ /**
+ * Module declaration.
+ *
+ * @since 9
+ */
+ MODULE
+}
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin13/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..ed69c0b04e
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/Retention.java b/JCL/converterJclMin13/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..b635cccb97
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/Retention.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin13/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..26349b1919
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/annotation/Target.java b/JCL/converterJclMin13/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..fcf6f550ad
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/annotation/Target.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin13/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..8a1fdd030e
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,38 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin13/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin13/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..90a46dc8fe
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin13/src/java/util/Collection.java b/JCL/converterJclMin13/src/java/util/Collection.java
new file mode 100644
index 0000000000..c6fb16779c
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin13/src/java/util/Iterator.java b/JCL/converterJclMin13/src/java/util/Iterator.java
new file mode 100644
index 0000000000..ae53f8408e
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin13/src/java/util/List.java b/JCL/converterJclMin13/src/java/util/List.java
new file mode 100644
index 0000000000..4565ccb902
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin13/src/java/util/Map.java b/JCL/converterJclMin13/src/java/util/Map.java
new file mode 100644
index 0000000000..f47752cfdb
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin13/src/java/util/function/Consumer.java b/JCL/converterJclMin13/src/java/util/function/Consumer.java
new file mode 100644
index 0000000000..dd5b3f408c
--- /dev/null
+++ b/JCL/converterJclMin13/src/java/util/function/Consumer.java
@@ -0,0 +1,10 @@
+package java.util.function;
+
+public interface Consumer<T> {
+
+ void accept(T t);
+
+ default Consumer<T> andThen(Consumer<? super T> after) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin13/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin13/src/javax/lang/model/SourceVersion.java
new file mode 100644
index 0000000000..557ab18118
--- /dev/null
+++ b/JCL/converterJclMin13/src/javax/lang/model/SourceVersion.java
@@ -0,0 +1,66 @@
+package javax.lang.model;
+
+public enum SourceVersion {
+
+ RELEASE_0,
+
+ RELEASE_1,
+
+ RELEASE_2,
+
+ RELEASE_3,
+
+ RELEASE_4,
+
+ RELEASE_5,
+
+ RELEASE_6,
+
+ RELEASE_7,
+
+ RELEASE_8,
+ RELEASE_9,
+
+ RELEASE_10,
+
+ RELEASE_11,
+
+ RELEASE_12,
+
+ RELEASE_13,
+ RELEASE_14;
+
+ public static SourceVersion latest() {
+ return RELEASE_14;
+ }
+
+ private static final SourceVersion latestSupported = getLatestSupported();
+
+ private static SourceVersion getLatestSupported() {
+ return RELEASE_14;
+ }
+
+ public static SourceVersion latestSupported() {
+ return latestSupported;
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ return true;
+ }
+
+ public static boolean isName(CharSequence name) {
+ return isName(name, latest());
+ }
+
+ public static boolean isName(CharSequence name, SourceVersion version) {
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return isKeyword(s, latest());
+ }
+
+ public static boolean isKeyword(CharSequence s, SourceVersion version) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin13/src/module-info.java b/JCL/converterJclMin13/src/module-info.java
new file mode 100644
index 0000000000..51a23b131b
--- /dev/null
+++ b/JCL/converterJclMin13/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/.classpath b/JCL/converterJclMin14/.classpath
new file mode 100644
index 0000000000..1cd9d959f9
--- /dev/null
+++ b/JCL/converterJclMin14/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin14/.project b/JCL/converterJclMin14/.project
new file mode 100644
index 0000000000..a031561b51
--- /dev/null
+++ b/JCL/converterJclMin14/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin14</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin14/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin14/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..910a770eed
--- /dev/null
+++ b/JCL/converterJclMin14/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,14 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=14
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=14
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=14
diff --git a/JCL/converterJclMin14/src/META-INF/MANIFEST.MF b/JCL/converterJclMin14/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c72a1fbae7
--- /dev/null
+++ b/JCL/converterJclMin14/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 1.8.0_151 (Oracle Corporation)
+
diff --git a/JCL/converterJclMin14/src/java/io/InputStream.java b/JCL/converterJclMin14/src/java/io/InputStream.java
new file mode 100644
index 0000000000..82511babed
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/io/InputStream.java
@@ -0,0 +1,5 @@
+package java.io;
+
+public class InputStream {
+
+}
diff --git a/JCL/converterJclMin14/src/java/io/PrintStream.java b/JCL/converterJclMin14/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..19059381a2
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/io/PrintStream.java
@@ -0,0 +1,8 @@
+package java.io;
+
+public class PrintStream {
+ public void println(String x) {
+ }
+ public void println(int x) {
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/io/Serializable.java b/JCL/converterJclMin14/src/java/io/Serializable.java
new file mode 100644
index 0000000000..3629567396
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/CharSequence.java b/JCL/converterJclMin14/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b03fc9e823
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Class.java b/JCL/converterJclMin14/src/java/lang/Class.java
new file mode 100644
index 0000000000..7d08bf1f38
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin14/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..7765ed820a
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class ClassNotFoundException extends ReflectiveOperationException {
+
+ public ClassNotFoundException() {
+ super((Throwable)null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s) {
+ super(s, null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s, Throwable ex) {
+ super(s, ex); // Disallow initCause
+ }
+
+ public Throwable getException() {
+ return getCause();
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin14/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..6f05a932fa
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Comparable.java b/JCL/converterJclMin14/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..59fb9eddd4
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Deprecated.java b/JCL/converterJclMin14/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..5226e586c7
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/Enum.java b/JCL/converterJclMin14/src/java/lang/Enum.java
new file mode 100644
index 0000000000..d95e7ae4d4
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/Error.java b/JCL/converterJclMin14/src/java/lang/Error.java
new file mode 100644
index 0000000000..820d8c6222
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Error.java
@@ -0,0 +1,16 @@
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error(java.lang.String s, java.lang.Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Exception.java b/JCL/converterJclMin14/src/java/lang/Exception.java
new file mode 100644
index 0000000000..88b222a9c0
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ super();
+ }
+
+ public Exception(String message) {
+ super(message);
+ }
+
+ public Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Exception(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin14/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..0d13e1e057
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin14/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin14/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..1f67418128
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/IncompatibleClassChangeError.java b/JCL/converterJclMin14/src/java/lang/IncompatibleClassChangeError.java
new file mode 100644
index 0000000000..9552b875b8
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/IncompatibleClassChangeError.java
@@ -0,0 +1,13 @@
+
+package java.lang;
+public
+class IncompatibleClassChangeError extends LinkageError {
+
+ public IncompatibleClassChangeError () {
+ super();
+ }
+
+ public IncompatibleClassChangeError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/InterruptedException.java b/JCL/converterJclMin14/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..93b236c421
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Iterable.java b/JCL/converterJclMin14/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..ab4b9d53f6
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Iterable.java
@@ -0,0 +1,10 @@
+package java.lang;
+
+import java.util.Iterator;
+import java.util.function.Consumer;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+ default void forEach(Consumer<? super T> action) {
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/LinkageError.java b/JCL/converterJclMin14/src/java/lang/LinkageError.java
new file mode 100644
index 0000000000..199d39d98b
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/LinkageError.java
@@ -0,0 +1,17 @@
+package java.lang;
+
+public
+class LinkageError extends Error {
+
+ public LinkageError() {
+ super();
+ }
+
+ public LinkageError(String s) {
+ super(s);
+ }
+
+ public LinkageError(String s, Throwable cause) {
+ super(s, cause);
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/NoClassDefFoundError.java b/JCL/converterJclMin14/src/java/lang/NoClassDefFoundError.java
new file mode 100644
index 0000000000..da0fe415c3
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/NoClassDefFoundError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoClassDefFoundError extends LinkageError {
+
+ public NoClassDefFoundError() {
+ super();
+ }
+
+ public NoClassDefFoundError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin14/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 0000000000..486e5339dc
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoSuchFieldError extends IncompatibleClassChangeError {
+
+ public NoSuchFieldError() {
+ super();
+ }
+
+ public NoSuchFieldError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin14/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..3dd142bdd3
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin14/src/java/lang/NullPointerException.java b/JCL/converterJclMin14/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..5e4ffa680d
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/NullPointerException.java
@@ -0,0 +1,11 @@
+package java.lang;
+public
+class NullPointerException extends RuntimeException {
+ public NullPointerException() {
+ super();
+ }
+
+ public NullPointerException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/Object.java b/JCL/converterJclMin14/src/java/lang/Object.java
new file mode 100644
index 0000000000..71ddb4ff83
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Override.java b/JCL/converterJclMin14/src/java/lang/Override.java
new file mode 100644
index 0000000000..b94fa6e860
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Override.java
@@ -0,0 +1,7 @@
+package java.lang;
+
+import java.lang.annotation.*;
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Record.java b/JCL/converterJclMin14/src/java/lang/Record.java
new file mode 100644
index 0000000000..c9913367b9
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Record.java
@@ -0,0 +1,9 @@
+package java.lang;
+public abstract class Record {
+ @Override
+ public abstract boolean equals(Object obj);
+ @Override
+ public abstract int hashCode();
+ @Override
+ public abstract String toString();
+}
diff --git a/JCL/converterJclMin14/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin14/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 0000000000..0860c67905
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,26 @@
+
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+
+ public ReflectiveOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ReflectiveOperationException(Throwable cause) {
+ super(cause);
+ }
+
+ public java.lang.Throwable getCause() {
+ return getCause();
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/RuntimeException.java b/JCL/converterJclMin14/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..3d94712d7f
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/RuntimeException.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+
+ public RuntimeException(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public RuntimeException() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/String.java b/JCL/converterJclMin14/src/java/lang/String.java
new file mode 100644
index 0000000000..64f759b78b
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/String.java
@@ -0,0 +1,8 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+ public int codePointAt(int index) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/System.java b/JCL/converterJclMin14/src/java/lang/System.java
new file mode 100644
index 0000000000..bf56c93aa2
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/System.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+public final class System {
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ private System() {
+ }
+
+ public static final InputStream in = null;
+
+ public static final PrintStream out = null;
+
+
+}
diff --git a/JCL/converterJclMin14/src/java/lang/Throwable.java b/JCL/converterJclMin14/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..73ab84b695
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/Throwable.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class Throwable {
+
+ public Throwable(java.lang.String message) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(java.lang.String message, Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin14/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..530c272ea4
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/Documented.java b/JCL/converterJclMin14/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..840d0f454e
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/Documented.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin14/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..7b5b59578e
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,48 @@
+package java.lang.annotation;
+
+public enum ElementType {
+ /** Class, interface (including annotation type), or enum declaration */
+ TYPE,
+
+ /** Field declaration (includes enum constants) */
+ FIELD,
+
+ /** Method declaration */
+ METHOD,
+
+ /** Formal parameter declaration */
+ PARAMETER,
+
+ /** Constructor declaration */
+ CONSTRUCTOR,
+
+ /** Local variable declaration */
+ LOCAL_VARIABLE,
+
+ /** Annotation type declaration */
+ ANNOTATION_TYPE,
+
+ /** Package declaration */
+ PACKAGE,
+
+ /**
+ * Type parameter declaration
+ *
+ * @since 1.8
+ */
+ TYPE_PARAMETER,
+
+ /**
+ * Use of a type
+ *
+ * @since 1.8
+ */
+ TYPE_USE,
+
+ /**
+ * Module declaration.
+ *
+ * @since 9
+ */
+ MODULE
+}
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin14/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..ed69c0b04e
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,7 @@
+package java.lang.annotation;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/Retention.java b/JCL/converterJclMin14/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..3896b228f5
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/Retention.java
@@ -0,0 +1,10 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Retention;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin14/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..26349b1919
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/annotation/Target.java b/JCL/converterJclMin14/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..c7654f5a5c
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/annotation/Target.java
@@ -0,0 +1,10 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin14/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..8a1fdd030e
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,38 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin14/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..f40dc8200b
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,21 @@
+package java.lang.invoke;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin14/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..90a46dc8fe
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/lang/runtime/ObjectMethods.java b/JCL/converterJclMin14/src/java/lang/runtime/ObjectMethods.java
new file mode 100644
index 0000000000..7587fef8f0
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/lang/runtime/ObjectMethods.java
@@ -0,0 +1,14 @@
+package java.lang.runtime;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.TypeDescriptor;
+
+public class ObjectMethods {
+ public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
+ Class<?> recordClass,
+ String names,
+ MethodHandle... getters) throws Throwable {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin14/src/java/util/Collection.java b/JCL/converterJclMin14/src/java/util/Collection.java
new file mode 100644
index 0000000000..c6fb16779c
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin14/src/java/util/Iterator.java b/JCL/converterJclMin14/src/java/util/Iterator.java
new file mode 100644
index 0000000000..ae53f8408e
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin14/src/java/util/List.java b/JCL/converterJclMin14/src/java/util/List.java
new file mode 100644
index 0000000000..4565ccb902
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin14/src/java/util/Map.java b/JCL/converterJclMin14/src/java/util/Map.java
new file mode 100644
index 0000000000..f47752cfdb
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin14/src/java/util/function/Consumer.java b/JCL/converterJclMin14/src/java/util/function/Consumer.java
new file mode 100644
index 0000000000..dd5b3f408c
--- /dev/null
+++ b/JCL/converterJclMin14/src/java/util/function/Consumer.java
@@ -0,0 +1,10 @@
+package java.util.function;
+
+public interface Consumer<T> {
+
+ void accept(T t);
+
+ default Consumer<T> andThen(Consumer<? super T> after) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin14/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin14/src/javax/lang/model/SourceVersion.java
new file mode 100644
index 0000000000..557ab18118
--- /dev/null
+++ b/JCL/converterJclMin14/src/javax/lang/model/SourceVersion.java
@@ -0,0 +1,66 @@
+package javax.lang.model;
+
+public enum SourceVersion {
+
+ RELEASE_0,
+
+ RELEASE_1,
+
+ RELEASE_2,
+
+ RELEASE_3,
+
+ RELEASE_4,
+
+ RELEASE_5,
+
+ RELEASE_6,
+
+ RELEASE_7,
+
+ RELEASE_8,
+ RELEASE_9,
+
+ RELEASE_10,
+
+ RELEASE_11,
+
+ RELEASE_12,
+
+ RELEASE_13,
+ RELEASE_14;
+
+ public static SourceVersion latest() {
+ return RELEASE_14;
+ }
+
+ private static final SourceVersion latestSupported = getLatestSupported();
+
+ private static SourceVersion getLatestSupported() {
+ return RELEASE_14;
+ }
+
+ public static SourceVersion latestSupported() {
+ return latestSupported;
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ return true;
+ }
+
+ public static boolean isName(CharSequence name) {
+ return isName(name, latest());
+ }
+
+ public static boolean isName(CharSequence name, SourceVersion version) {
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return isKeyword(s, latest());
+ }
+
+ public static boolean isKeyword(CharSequence s, SourceVersion version) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin14/src/module-info.java b/JCL/converterJclMin14/src/module-info.java
new file mode 100644
index 0000000000..51a23b131b
--- /dev/null
+++ b/JCL/converterJclMin14/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/.classpath b/JCL/converterJclMin15/.classpath
new file mode 100644
index 0000000000..7d3b4d8d1c
--- /dev/null
+++ b/JCL/converterJclMin15/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin15/.project b/JCL/converterJclMin15/.project
new file mode 100644
index 0000000000..63a468f98d
--- /dev/null
+++ b/JCL/converterJclMin15/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin15</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin15/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin15/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..223b166729
--- /dev/null
+++ b/JCL/converterJclMin15/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,14 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=15
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=15
diff --git a/JCL/converterJclMin15/src/META-INF/MANIFEST.MF b/JCL/converterJclMin15/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c72a1fbae7
--- /dev/null
+++ b/JCL/converterJclMin15/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 1.8.0_151 (Oracle Corporation)
+
diff --git a/JCL/converterJclMin15/src/java/io/InputStream.java b/JCL/converterJclMin15/src/java/io/InputStream.java
new file mode 100644
index 0000000000..82511babed
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/io/InputStream.java
@@ -0,0 +1,5 @@
+package java.io;
+
+public class InputStream {
+
+}
diff --git a/JCL/converterJclMin15/src/java/io/PrintStream.java b/JCL/converterJclMin15/src/java/io/PrintStream.java
new file mode 100644
index 0000000000..19059381a2
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/io/PrintStream.java
@@ -0,0 +1,8 @@
+package java.io;
+
+public class PrintStream {
+ public void println(String x) {
+ }
+ public void println(int x) {
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/io/Serializable.java b/JCL/converterJclMin15/src/java/io/Serializable.java
new file mode 100644
index 0000000000..edd882d7d5
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/CharSequence.java b/JCL/converterJclMin15/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b9a0d9e417
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Class.java b/JCL/converterJclMin15/src/java/lang/Class.java
new file mode 100644
index 0000000000..a7667b9834
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin15/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 0000000000..7765ed820a
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class ClassNotFoundException extends ReflectiveOperationException {
+
+ public ClassNotFoundException() {
+ super((Throwable)null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s) {
+ super(s, null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s, Throwable ex) {
+ super(s, ex); // Disallow initCause
+ }
+
+ public Throwable getException() {
+ return getCause();
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin15/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..cb777dc7ba
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Comparable.java b/JCL/converterJclMin15/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..fbc6c8bac3
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Deprecated.java b/JCL/converterJclMin15/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..6c73dedd0d
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/Enum.java b/JCL/converterJclMin15/src/java/lang/Enum.java
new file mode 100644
index 0000000000..05c8d2728b
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/Error.java b/JCL/converterJclMin15/src/java/lang/Error.java
new file mode 100644
index 0000000000..9a446d5324
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Error.java
@@ -0,0 +1,16 @@
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error(java.lang.String s, java.lang.Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Exception.java b/JCL/converterJclMin15/src/java/lang/Exception.java
new file mode 100644
index 0000000000..0adef36baf
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ super();
+ }
+
+ public Exception(String message) {
+ super(message);
+ }
+
+ public Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Exception(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin15/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..814649067f
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin15/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin15/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..e173f133ab
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/IncompatibleClassChangeError.java b/JCL/converterJclMin15/src/java/lang/IncompatibleClassChangeError.java
new file mode 100644
index 0000000000..9552b875b8
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/IncompatibleClassChangeError.java
@@ -0,0 +1,13 @@
+
+package java.lang;
+public
+class IncompatibleClassChangeError extends LinkageError {
+
+ public IncompatibleClassChangeError () {
+ super();
+ }
+
+ public IncompatibleClassChangeError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/InterruptedException.java b/JCL/converterJclMin15/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..e2e84ba0bc
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Iterable.java b/JCL/converterJclMin15/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..ab4b9d53f6
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Iterable.java
@@ -0,0 +1,10 @@
+package java.lang;
+
+import java.util.Iterator;
+import java.util.function.Consumer;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+ default void forEach(Consumer<? super T> action) {
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/LinkageError.java b/JCL/converterJclMin15/src/java/lang/LinkageError.java
new file mode 100644
index 0000000000..199d39d98b
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/LinkageError.java
@@ -0,0 +1,17 @@
+package java.lang;
+
+public
+class LinkageError extends Error {
+
+ public LinkageError() {
+ super();
+ }
+
+ public LinkageError(String s) {
+ super(s);
+ }
+
+ public LinkageError(String s, Throwable cause) {
+ super(s, cause);
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/NoClassDefFoundError.java b/JCL/converterJclMin15/src/java/lang/NoClassDefFoundError.java
new file mode 100644
index 0000000000..da0fe415c3
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/NoClassDefFoundError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoClassDefFoundError extends LinkageError {
+
+ public NoClassDefFoundError() {
+ super();
+ }
+
+ public NoClassDefFoundError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin15/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 0000000000..486e5339dc
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoSuchFieldError extends IncompatibleClassChangeError {
+
+ public NoSuchFieldError() {
+ super();
+ }
+
+ public NoSuchFieldError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin15/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..b8c5bce7a5
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin15/src/java/lang/NullPointerException.java b/JCL/converterJclMin15/src/java/lang/NullPointerException.java
new file mode 100644
index 0000000000..5e4ffa680d
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/NullPointerException.java
@@ -0,0 +1,11 @@
+package java.lang;
+public
+class NullPointerException extends RuntimeException {
+ public NullPointerException() {
+ super();
+ }
+
+ public NullPointerException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/Object.java b/JCL/converterJclMin15/src/java/lang/Object.java
new file mode 100644
index 0000000000..eb50899e5b
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Override.java b/JCL/converterJclMin15/src/java/lang/Override.java
new file mode 100644
index 0000000000..b94fa6e860
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Override.java
@@ -0,0 +1,7 @@
+package java.lang;
+
+import java.lang.annotation.*;
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Record.java b/JCL/converterJclMin15/src/java/lang/Record.java
new file mode 100644
index 0000000000..c9913367b9
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Record.java
@@ -0,0 +1,9 @@
+package java.lang;
+public abstract class Record {
+ @Override
+ public abstract boolean equals(Object obj);
+ @Override
+ public abstract int hashCode();
+ @Override
+ public abstract String toString();
+}
diff --git a/JCL/converterJclMin15/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin15/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 0000000000..0860c67905
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,26 @@
+
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+
+ public ReflectiveOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ReflectiveOperationException(Throwable cause) {
+ super(cause);
+ }
+
+ public java.lang.Throwable getCause() {
+ return getCause();
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/RuntimeException.java b/JCL/converterJclMin15/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..80dc1dbd34
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/RuntimeException.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+
+ public RuntimeException(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public RuntimeException() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/String.java b/JCL/converterJclMin15/src/java/lang/String.java
new file mode 100644
index 0000000000..ba6bf08bf4
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/String.java
@@ -0,0 +1,8 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+ public int codePointAt(int index) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/System.java b/JCL/converterJclMin15/src/java/lang/System.java
new file mode 100644
index 0000000000..bf56c93aa2
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/System.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+public final class System {
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ private System() {
+ }
+
+ public static final InputStream in = null;
+
+ public static final PrintStream out = null;
+
+
+}
diff --git a/JCL/converterJclMin15/src/java/lang/Throwable.java b/JCL/converterJclMin15/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..2488269beb
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/Throwable.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class Throwable {
+
+ public Throwable(java.lang.String message) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(java.lang.String message, Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin15/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..ba72aad15e
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/Documented.java b/JCL/converterJclMin15/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..34494fb5f3
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/Documented.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin15/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..7b5b59578e
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,48 @@
+package java.lang.annotation;
+
+public enum ElementType {
+ /** Class, interface (including annotation type), or enum declaration */
+ TYPE,
+
+ /** Field declaration (includes enum constants) */
+ FIELD,
+
+ /** Method declaration */
+ METHOD,
+
+ /** Formal parameter declaration */
+ PARAMETER,
+
+ /** Constructor declaration */
+ CONSTRUCTOR,
+
+ /** Local variable declaration */
+ LOCAL_VARIABLE,
+
+ /** Annotation type declaration */
+ ANNOTATION_TYPE,
+
+ /** Package declaration */
+ PACKAGE,
+
+ /**
+ * Type parameter declaration
+ *
+ * @since 1.8
+ */
+ TYPE_PARAMETER,
+
+ /**
+ * Use of a type
+ *
+ * @since 1.8
+ */
+ TYPE_USE,
+
+ /**
+ * Module declaration.
+ *
+ * @since 9
+ */
+ MODULE
+}
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin15/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..9753e0c412
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/Retention.java b/JCL/converterJclMin15/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..72f141758b
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/Retention.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin15/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..b69fa7d654
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/annotation/Target.java b/JCL/converterJclMin15/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..239f6b1ee6
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/annotation/Target.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin15/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..789476586d
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,39 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.invoke.MethodType;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin15/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..49d9f1f87a
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,22 @@
+package java.lang.invoke;
+import java.lang.invoke.MethodType;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin15/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..802a3f2c80
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/lang/runtime/ObjectMethods.java b/JCL/converterJclMin15/src/java/lang/runtime/ObjectMethods.java
new file mode 100644
index 0000000000..7587fef8f0
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/lang/runtime/ObjectMethods.java
@@ -0,0 +1,14 @@
+package java.lang.runtime;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.TypeDescriptor;
+
+public class ObjectMethods {
+ public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
+ Class<?> recordClass,
+ String names,
+ MethodHandle... getters) throws Throwable {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin15/src/java/util/Collection.java b/JCL/converterJclMin15/src/java/util/Collection.java
new file mode 100644
index 0000000000..a40b2d29a3
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin15/src/java/util/Iterator.java b/JCL/converterJclMin15/src/java/util/Iterator.java
new file mode 100644
index 0000000000..f90ee762c2
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin15/src/java/util/List.java b/JCL/converterJclMin15/src/java/util/List.java
new file mode 100644
index 0000000000..7d19bdfb1b
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin15/src/java/util/Map.java b/JCL/converterJclMin15/src/java/util/Map.java
new file mode 100644
index 0000000000..574a7f816a
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin15/src/java/util/function/Consumer.java b/JCL/converterJclMin15/src/java/util/function/Consumer.java
new file mode 100644
index 0000000000..dd5b3f408c
--- /dev/null
+++ b/JCL/converterJclMin15/src/java/util/function/Consumer.java
@@ -0,0 +1,10 @@
+package java.util.function;
+
+public interface Consumer<T> {
+
+ void accept(T t);
+
+ default Consumer<T> andThen(Consumer<? super T> after) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java
new file mode 100644
index 0000000000..557ab18118
--- /dev/null
+++ b/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java
@@ -0,0 +1,66 @@
+package javax.lang.model;
+
+public enum SourceVersion {
+
+ RELEASE_0,
+
+ RELEASE_1,
+
+ RELEASE_2,
+
+ RELEASE_3,
+
+ RELEASE_4,
+
+ RELEASE_5,
+
+ RELEASE_6,
+
+ RELEASE_7,
+
+ RELEASE_8,
+ RELEASE_9,
+
+ RELEASE_10,
+
+ RELEASE_11,
+
+ RELEASE_12,
+
+ RELEASE_13,
+ RELEASE_14;
+
+ public static SourceVersion latest() {
+ return RELEASE_14;
+ }
+
+ private static final SourceVersion latestSupported = getLatestSupported();
+
+ private static SourceVersion getLatestSupported() {
+ return RELEASE_14;
+ }
+
+ public static SourceVersion latestSupported() {
+ return latestSupported;
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ return true;
+ }
+
+ public static boolean isName(CharSequence name) {
+ return isName(name, latest());
+ }
+
+ public static boolean isName(CharSequence name, SourceVersion version) {
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return isKeyword(s, latest());
+ }
+
+ public static boolean isKeyword(CharSequence s, SourceVersion version) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin15/src/module-info.java b/JCL/converterJclMin15/src/module-info.java
new file mode 100644
index 0000000000..51a23b131b
--- /dev/null
+++ b/JCL/converterJclMin15/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/.classpath b/JCL/converterJclMin9/.classpath
new file mode 100644
index 0000000000..6ee61f2eb4
--- /dev/null
+++ b/JCL/converterJclMin9/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/JCL/converterJclMin9/.project b/JCL/converterJclMin9/.project
new file mode 100644
index 0000000000..dba36dc780
--- /dev/null
+++ b/JCL/converterJclMin9/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin9</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin9/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin9/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..021167ab6f
--- /dev/null
+++ b/JCL/converterJclMin9/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=9
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=9
diff --git a/JCL/converterJclMin9/src/java/io/Serializable.java b/JCL/converterJclMin9/src/java/io/Serializable.java
new file mode 100644
index 0000000000..3629567396
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/CharSequence.java b/JCL/converterJclMin9/src/java/lang/CharSequence.java
new file mode 100644
index 0000000000..b03fc9e823
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Class.java b/JCL/converterJclMin9/src/java/lang/Class.java
new file mode 100644
index 0000000000..7d08bf1f38
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin9/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 0000000000..6f05a932fa
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Comparable.java b/JCL/converterJclMin9/src/java/lang/Comparable.java
new file mode 100644
index 0000000000..59fb9eddd4
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Deprecated.java b/JCL/converterJclMin9/src/java/lang/Deprecated.java
new file mode 100644
index 0000000000..5226e586c7
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/Enum.java b/JCL/converterJclMin9/src/java/lang/Enum.java
new file mode 100644
index 0000000000..d95e7ae4d4
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Enum.java
@@ -0,0 +1,14 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/Error.java b/JCL/converterJclMin9/src/java/lang/Error.java
new file mode 100644
index 0000000000..02f4405bde
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Error.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Error extends Throwable {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Exception.java b/JCL/converterJclMin9/src/java/lang/Exception.java
new file mode 100644
index 0000000000..6e3cf321f9
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Exception.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Exception extends Throwable {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin9/src/java/lang/IllegalAccessException.java
new file mode 100644
index 0000000000..0d13e1e057
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin9/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin9/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 0000000000..1f67418128
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/InterruptedException.java b/JCL/converterJclMin9/src/java/lang/InterruptedException.java
new file mode 100644
index 0000000000..93b236c421
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Iterable.java b/JCL/converterJclMin9/src/java/lang/Iterable.java
new file mode 100644
index 0000000000..c6f20607b2
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Iterable.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.util.Iterator;
+public interface Iterable<T> {
+ Iterator<T> iterator();
+}
+
diff --git a/JCL/converterJclMin9/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin9/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 0000000000..3dd142bdd3
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Object.java b/JCL/converterJclMin9/src/java/lang/Object.java
new file mode 100644
index 0000000000..71ddb4ff83
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin9/src/java/lang/RuntimeException.java b/JCL/converterJclMin9/src/java/lang/RuntimeException.java
new file mode 100644
index 0000000000..3be7f777cc
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/RuntimeException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/String.java b/JCL/converterJclMin9/src/java/lang/String.java
new file mode 100644
index 0000000000..38fc3e31f3
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/String.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+}
diff --git a/JCL/converterJclMin9/src/java/lang/Throwable.java b/JCL/converterJclMin9/src/java/lang/Throwable.java
new file mode 100644
index 0000000000..031917ca53
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/Throwable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Throwable {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin9/src/java/lang/annotation/Annotation.java
new file mode 100644
index 0000000000..530c272ea4
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/Documented.java b/JCL/converterJclMin9/src/java/lang/annotation/Documented.java
new file mode 100644
index 0000000000..b70fc96961
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/Documented.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin9/src/java/lang/annotation/ElementType.java
new file mode 100644
index 0000000000..b6dd0f6d5d
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+public enum ElementType {
+ ANNOTATION_TYPE,
+ CONSTRUCTOR,
+ FIELD,
+ LOCAL_VARIABLE,
+ METHOD,
+ PACKAGE,
+ PARAMETER,
+ TYPE,
+ TYPE_USE,
+ TYPE_PARAMETER,
+}
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin9/src/java/lang/annotation/Inherited.java
new file mode 100644
index 0000000000..e51219ed39
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/Retention.java b/JCL/converterJclMin9/src/java/lang/annotation/Retention.java
new file mode 100644
index 0000000000..9a23c8186d
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/Retention.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin9/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 0000000000..26349b1919
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/annotation/Target.java b/JCL/converterJclMin9/src/java/lang/annotation/Target.java
new file mode 100644
index 0000000000..8cd620502a
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/annotation/Target.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000000..69736475bd
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,39 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.invoke.MethodType;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 0000000000..582995d9d8
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,22 @@
+package java.lang.invoke;
+import java.lang.invoke.MethodType;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin9/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin9/src/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000000..90a46dc8fe
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin9/src/java/util/Collection.java b/JCL/converterJclMin9/src/java/util/Collection.java
new file mode 100644
index 0000000000..c6fb16779c
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin9/src/java/util/Iterator.java b/JCL/converterJclMin9/src/java/util/Iterator.java
new file mode 100644
index 0000000000..ae53f8408e
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin9/src/java/util/List.java b/JCL/converterJclMin9/src/java/util/List.java
new file mode 100644
index 0000000000..4565ccb902
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin9/src/java/util/Map.java b/JCL/converterJclMin9/src/java/util/Map.java
new file mode 100644
index 0000000000..f47752cfdb
--- /dev/null
+++ b/JCL/converterJclMin9/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin9/src/module-info.java b/JCL/converterJclMin9/src/module-info.java
new file mode 100644
index 0000000000..13fd25e6b0
--- /dev/null
+++ b/JCL/converterJclMin9/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+}
diff --git a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java
index e0b7dab71c..af6cb5c710 100644
--- a/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java
+++ b/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2019 BEA Systems Inc. and others
+ * Copyright (c) 2005, 2020 BEA Systems Inc. and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -85,7 +85,7 @@ import com.sun.mirror.util.Types;
*/
public class BaseProcessorEnv implements AnnotationProcessorEnvironment
{
- private static final int JLS_LATEST = AST.JLS14;
+ private static final int JLS_LATEST = AST.JLS15;
static{
final AST ast = AST.newAST(JLS_LATEST, true);
EMPTY_AST_UNIT = ast.newCompilationUnit();
diff --git a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/ReadAnnotationTests2.java b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/ReadAnnotationTests2.java
index a57a7d2222..18e52ddd1d 100644
--- a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/ReadAnnotationTests2.java
+++ b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/ReadAnnotationTests2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2019 BEA Systems, Inc.
+ * Copyright (c) 2005, 2020 BEA Systems, Inc.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -187,7 +187,7 @@ public class ReadAnnotationTests2 extends BuilderTests {
}
final BindingRequestor requestor = new BindingRequestor();
- final ASTParser parser = ASTParser.newParser(AST.JLS14);
+ final ASTParser parser = ASTParser.newParser(AST.JLS15);
parser.setResolveBindings(true);
parser.setProject(javaProj);
parser.setIgnoreMethodBodies(true);
diff --git a/org.eclipse.jdt.compiler.apt.tests/.classpath b/org.eclipse.jdt.compiler.apt.tests/.classpath
index b3e488f935..883f44e4dd 100644
--- a/org.eclipse.jdt.compiler.apt.tests/.classpath
+++ b/org.eclipse.jdt.compiler.apt.tests/.classpath
@@ -16,7 +16,7 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="lib/java14api.jar"/>
+ <classpathentry kind="lib" path="lib/javax15api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
index 2842297015..8f839a0465 100644
--- a/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.compiler.apt.tests/META-INF/MANIFEST.MF
@@ -19,6 +19,6 @@ Export-Package: org.eclipse.jdt.compiler.apt.tests,
org.eclipse.jdt.compiler.apt.tests.processors.visitors
Import-Package: org.eclipse.jdt.internal.compiler.tool;resolution:=optional
Eclipse-BundleShape: dir
-Bundle-ClassPath: lib/java14api.jar,
+Bundle-ClassPath: lib/javax15api.jar,
.
Automatic-Module-Name: org.eclipse.jdt.compiler.apt.tests
diff --git a/org.eclipse.jdt.compiler.apt.tests/build.properties b/org.eclipse.jdt.compiler.apt.tests/build.properties
index 0f35ce6bb2..06642fc2a5 100644
--- a/org.eclipse.jdt.compiler.apt.tests/build.properties
+++ b/org.eclipse.jdt.compiler.apt.tests/build.properties
@@ -27,4 +27,4 @@ bin.includes = about.html,\
.
src.includes = about.html
compilerArg=-proc:none
-jars.extra.classpath = lib/java14api.jar
+jars.extra.classpath = lib/javax15api.jar
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
index bc0dad2401..6015cd8c1f 100644
--- a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
+++ b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors8.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/java14api.jar b/org.eclipse.jdt.compiler.apt.tests/lib/javax15api.jar
index e24da08002..c451cc2ba9 100644
--- a/org.eclipse.jdt.compiler.apt.tests/lib/java14api.jar
+++ b/org.eclipse.jdt.compiler.apt.tests/lib/javax15api.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/META-INF/services/javax.annotation.processing.Processor b/org.eclipse.jdt.compiler.apt.tests/processors8/META-INF/services/javax.annotation.processing.Processor
index 9d41927192..dfe8bcb0d1 100644
--- a/org.eclipse.jdt.compiler.apt.tests/processors8/META-INF/services/javax.annotation.processing.Processor
+++ b/org.eclipse.jdt.compiler.apt.tests/processors8/META-INF/services/javax.annotation.processing.Processor
@@ -4,4 +4,5 @@ org.eclipse.jdt.compiler.apt.tests.processors.elements.Java9ModuleProcessor
org.eclipse.jdt.compiler.apt.tests.processors.elements.Java11ElementProcessor
org.eclipse.jdt.compiler.apt.tests.processors.elements.Java12ElementProcessor
org.eclipse.jdt.compiler.apt.tests.processors.elements.Java13ElementProcessor
-org.eclipse.jdt.compiler.apt.tests.processors.elements.Java14ElementProcessor
+org.eclipse.jdt.compiler.apt.tests.processors.elements.RecordElementProcessor
+org.eclipse.jdt.compiler.apt.tests.processors.elements.SealedTypeElementProcessor
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/BaseElementProcessor.java b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/BaseElementProcessor.java
new file mode 100644
index 0000000000..d33be3f707
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/BaseElementProcessor.java
@@ -0,0 +1,313 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.compiler.apt.tests.processors.elements;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.Messager;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.AnnotatedConstruct;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.RecordComponentElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.util.ElementScanner14;
+
+import org.eclipse.jdt.compiler.apt.tests.processors.base.BaseProcessor;
+
+@SupportedAnnotationTypes("*")
+abstract class BaseElementProcessor extends BaseProcessor {
+ boolean reportSuccessAlready = true;
+ RoundEnvironment roundEnv = null;
+ Messager _messager = null;
+ Filer _filer = null;
+ boolean isBinaryMode = false;
+ String mode;
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ _elementUtils = processingEnv.getElementUtils();
+ _messager = processingEnv.getMessager();
+ _filer = processingEnv.getFiler();
+ }
+ // Always return false from this processor, because it supports "*".
+ // The return value does not signify success or failure!
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (roundEnv.processingOver()) {
+ return false;
+ }
+
+ this.roundEnv = roundEnv;
+ Map<String, String> options = processingEnv.getOptions();
+ if (!options.containsKey(this.getClass().getName())) {
+ // Disable this processor unless we are intentionally performing the test.
+ return false;
+ } else {
+ try {
+ if (options.containsKey("binary")) {
+ this.isBinaryMode = true;
+ this.mode = "binary";
+ } else {
+ this.mode = "source";
+ }
+ if (!invokeTestMethods(options)) {
+ testAll();
+ }
+ if (this.reportSuccessAlready) {
+ super.reportSuccess();
+ }
+ } catch (AssertionFailedError e) {
+ super.reportError(getExceptionStackTrace(e));
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ private boolean invokeTestMethods(Map<String, String> options) throws Throwable {
+ Method testMethod = null;
+ Set<String> keys = options.keySet();
+ boolean testsFound = false;
+ for (String option : keys) {
+ if (option.startsWith("test")) {
+ try {
+ testMethod = this.getClass().getDeclaredMethod(option, new Class[0]);
+ if (testMethod != null) {
+ testsFound = true;
+ testMethod.invoke(this, new Object[0]);
+ }
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ } catch (Exception e) {
+ super.reportError(getExceptionStackTrace(e));
+ }
+ }
+ }
+ return testsFound;
+ }
+
+ protected abstract void testAll() throws AssertionFailedError, IOException;
+
+ @Override
+ public void reportError(String msg) {
+ throw new AssertionFailedError(msg + " (Binary mode= " + isBinaryMode + ")");
+ }
+ protected String getExceptionStackTrace(Throwable t) {
+ StringBuffer buf = new StringBuffer(t.getMessage());
+ StackTraceElement[] traces = t.getStackTrace();
+ for (int i = 0; i < traces.length; i++) {
+ StackTraceElement trace = traces[i];
+ buf.append("\n\tat " + trace);
+ if (i == 12)
+ break; // Don't dump all stacks
+ }
+ return buf.toString();
+ }
+ protected String getElementsAsString(List<? extends Element> list) {
+ StringBuilder builder = new StringBuilder("[");
+ for (Element element : list) {
+ if (element instanceof PackageElement) {
+ builder.append(((PackageElement) element).getQualifiedName());
+ } else if (element instanceof ModuleElement) {
+ builder.append(((ModuleElement) element).getQualifiedName());
+ } else if (element instanceof TypeElement) {
+ builder.append(((TypeElement) element).getQualifiedName());
+ } else {
+ builder.append(element.getSimpleName());
+ }
+ builder.append(", ");
+ }
+ builder.append("]");
+ return builder.toString();
+ }
+ public void assertModifiers(Set<Modifier> modifiers, String[] expected) {
+ assertEquals("Incorrect no of modifiers", modifiers.size(), expected.length);
+ Set<String> actual = new HashSet<String>(expected.length);
+ for (Modifier modifier : modifiers) {
+ actual.add(modifier.toString());
+ }
+ for(int i = 0, length = expected.length; i < length; i++) {
+ boolean result = actual.remove(expected[i]);
+ if (!result) reportError("Modifier not present :" + expected[i]);
+ }
+ if (!actual.isEmpty()) {
+ reportError("Unexpected modifiers present:" + actual.toString());
+ }
+ }
+ public void assertTrue(String msg, boolean value) {
+ if (!value) reportError(msg);
+ }
+ public void assertFalse(String msg, boolean value) {
+ if (value) reportError(msg);
+ }
+ public void assertSame(String msg, Object obj1, Object obj2) {
+ if (obj1 != obj2) {
+ reportError(msg + ", should be " + obj1.toString() + " but " + obj2.toString());
+ }
+ }
+ public void assertNotSame(String msg, Object obj1, Object obj2) {
+ if (obj1 == obj2) {
+ reportError(msg + ", " + obj1.toString() + " should not be same as " + obj2.toString());
+ }
+ }
+ public void assertNotNull(String msg, Object obj) {
+ if (obj == null) {
+ reportError(msg);
+ }
+ }
+ public void assertNull(String msg, Object obj) {
+ if (obj != null) {
+ reportError(msg);
+ }
+ }
+ public void assertEquals(String message, Object expected, Object actual) {
+ if (equalsRegardingNull(expected, actual)) {
+ return;
+ } else {
+ reportError(message + ", expected " + expected.toString() + " but was " + actual.toString());
+ }
+ }
+
+ public void assertEquals(String message, Object expected, Object alternateExpected, Object actual) {
+ if (equalsRegardingNull(expected, actual) || equalsRegardingNull(alternateExpected, actual)) {
+ return;
+ } else {
+ reportError(message + ", expected " + expected.toString() + " but was " + actual.toString());
+ }
+ }
+
+ static boolean equalsRegardingNull(Object expected, Object actual) {
+ if (expected == null) {
+ return actual == null;
+ }
+ return expected.equals(actual);
+ }
+
+ public void assertEquals(String msg, int expected, int actual) {
+ if (expected != actual) {
+ StringBuffer buf = new StringBuffer();
+ buf.append(msg);
+ buf.append(", expected " + expected + " but was " + actual);
+ reportError(buf.toString());
+ }
+ }
+ public void assertEquals(Object expected, Object actual) {
+ if (expected != actual) {
+
+ }
+ }
+ protected void verifyAnnotations(AnnotatedConstruct construct, String[] annots) {
+ List<? extends AnnotationMirror> annotations = construct.getAnnotationMirrors();
+ assertEquals("Incorrect no of annotations", annots.length, annotations.size());
+ for(int i = 0, length = annots.length; i < length; i++) {
+ AnnotationMirror mirror = annotations.get(i);
+ assertEquals("Invalid annotation value", annots[i], getAnnotationString(mirror));
+ }
+ }
+
+ private String getAnnotationString(AnnotationMirror annot) {
+ DeclaredType annotType = annot.getAnnotationType();
+ TypeElement type = (TypeElement) annotType.asElement();
+ StringBuffer buf = new StringBuffer("@" + type.getSimpleName());
+ Map<? extends ExecutableElement, ? extends AnnotationValue> values = annot.getElementValues();
+ Set<? extends ExecutableElement> keys = values.keySet();
+ buf.append('(');
+ for (ExecutableElement executableElement : keys) { // @Marker3()
+ buf.append(executableElement.getSimpleName());
+ buf.append('=');
+ AnnotationValue value = values.get(executableElement);
+ buf.append(value.getValue());
+ }
+ buf.append(')');
+ return buf.toString();
+ }
+ class AssertionFailedError extends Error {
+ private static final long serialVersionUID = 1L;
+
+ public AssertionFailedError(String msg) {
+ super(msg);
+ }
+ }
+
+ class ScannerImpl<R, P> extends ElementScanner14<R, P> {
+ public Object el;
+ boolean isType;
+ boolean isMethod;
+ public boolean visited;
+ public boolean scanned;
+ R result;
+ public Object param;
+
+ public List<TypeParameterElement> params = new ArrayList<>();
+
+ public ScannerImpl() {
+ super();
+ }
+
+ public ScannerImpl(R r) {
+ super(r);
+ }
+
+ @Override
+ public R visitType(TypeElement e, P p) {
+ el = e;
+ param = p;
+ isType = true;
+ return super.visitType(e, p);
+ }
+
+ @Override
+ public R visitExecutable(ExecutableElement e, P p) {
+ isMethod = true;
+ el = e;
+ param = p;
+ return super.visitExecutable(e, p);
+ }
+
+ public R visitRecordComponent(RecordComponentElement e, P p) {
+ el = e;
+ param = p;
+ visited = true;
+ return super.visitRecordComponent(e, p);
+ }
+
+ public R scan(Element e, P p) {
+ scanned = true;
+ if (e instanceof TypeParameterElement) {
+ params.add((TypeParameterElement) e);
+ }
+ return DEFAULT_VALUE;
+ }
+ }
+}
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/RecordElementProcessor.java
index b95752a1cf..7b70533aaa 100644
--- a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/Java14ElementProcessor.java
+++ b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/RecordElementProcessor.java
@@ -19,7 +19,6 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -33,30 +32,23 @@ import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.lang.model.AnnotatedConstruct;
import javax.lang.model.element.AnnotationMirror;
-import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
-import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.PackageElement;
import javax.lang.model.element.RecordComponentElement;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.ExecutableType;
import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
-import javax.lang.model.util.ElementScanner14;
import org.eclipse.jdt.internal.compiler.apt.dispatch.BaseProcessingEnvImpl;
-import org.eclipse.jdt.compiler.apt.tests.processors.base.BaseProcessor;
@SupportedAnnotationTypes("*")
-public class Java14ElementProcessor extends BaseProcessor {
+public class RecordElementProcessor extends BaseElementProcessor {
boolean reportSuccessAlready = true;
RoundEnvironment roundEnv = null;
Messager _messager = null;
@@ -260,7 +252,7 @@ public class Java14ElementProcessor extends BaseProcessor {
modifiers = toSMethod.getModifiers();
assertTrue("should be public", modifiers.contains(Modifier.PUBLIC));
assertTrue("should be strictfp", modifiers.contains(Modifier.STRICTFP));
- assertFalse("should not be final", modifiers.contains(Modifier.FINAL));
+ assertTrue("should be final", modifiers.contains(Modifier.FINAL));
modifiers = hashMethod.getModifiers();
assertTrue("should be public", modifiers.contains(Modifier.PUBLIC));
assertTrue("should be final", modifiers.contains(Modifier.FINAL));
@@ -327,6 +319,55 @@ public class Java14ElementProcessor extends BaseProcessor {
assertEquals("Incorrect kind of element", ElementKind.RECORD_COMPONENT, element.getKind());
recordComponent = (RecordComponentElement) element;
verifyAnnotations(recordComponent, new String[]{});
+ List<ExecutableElement> methodsIn = ElementFilter.methodsIn(enclosedElements);
+ List<String> actualMethodNames = methodsIn.stream().filter((m) -> m.getSimpleName().toString().startsWith("comp"))
+ .map((m) -> m.getSimpleName().toString())
+ .collect(Collectors.toList());
+ assertEquals("incorrect method", 5, actualMethodNames.size());
+ for (ExecutableElement method : methodsIn) {
+ if (method.getSimpleName().toString().equals("comp_")) {
+ verifyAnnotations(method, new String[]{});
+ TypeMirror asType = method.asType();
+ verifyAnnotations(asType, new String[]{});
+ } else if (method.getSimpleName().toString().equals("comp2_")) {
+ verifyAnnotations(method, new String[]{"@MyAnnot2()"});
+ TypeMirror asType = method.asType();
+ verifyAnnotations(asType, new String[]{});
+ } else if (method.getSimpleName().toString().equals("comp3_")) {
+ verifyAnnotations(method, new String[]{"@MyAnnot3()"});
+ TypeMirror asType = method.asType();
+ verifyAnnotations(asType, new String[]{});
+ } else if (method.getSimpleName().toString().equals("comp4_")) {
+ verifyAnnotations(method, new String[]{});
+ TypeMirror asType = method.asType();
+ verifyAnnotations(asType, new String[]{});
+ } else if (method.getSimpleName().toString().equals("comp5_")) {
+ verifyAnnotations(method, new String[]{});
+ TypeMirror asType = method.asType();
+ verifyAnnotations(asType, new String[]{});
+ }
+ }
+ methodsIn = ElementFilter.constructorsIn(enclosedElements);
+ assertEquals("incorrect method", 1, methodsIn.size());
+ ExecutableElement m = methodsIn.get(0);
+ verifyAnnotations(m, new String[]{});
+ TypeMirror asType = m.asType();
+ verifyAnnotations(asType, new String[]{});
+ List<? extends VariableElement> parameters = m.getParameters();
+ assertEquals("incorrect parameters", 5, parameters.size());
+ for (VariableElement v : parameters) {
+ if (v.getSimpleName().toString().equals("comp_")) {
+ verifyAnnotations(v, new String[]{"@MyAnnot()"}); // ECJ fails
+ } else if (v.getSimpleName().toString().equals("comp2_")) {
+ verifyAnnotations(v, new String[]{"@MyAnnot2()"});
+ } else if (v.getSimpleName().toString().equals("comp3_")) {
+ verifyAnnotations(v, new String[]{}); // ECJ fails
+ } else if (v.getSimpleName().toString().equals("comp4_")) {
+ verifyAnnotations(v, new String[]{}); // ECJ fails
+ } else if (v.getSimpleName().toString().equals("comp5_")) {
+ verifyAnnotations(v, new String[]{});
+ }
+ }
}
public void testRecords5() {
Map<String, TypeKind> expRecComps = new HashMap<>();
@@ -521,196 +562,4 @@ public class Java14ElementProcessor extends BaseProcessor {
assertFalse("Should not be varargs for \"" + name + "\".", accessor.isVarArgs());
}
}
-
- @Override
- public void reportError(String msg) {
- throw new AssertionFailedError(msg);
- }
- private String getExceptionStackTrace(Throwable t) {
- StringBuffer buf = new StringBuffer(t.getMessage());
- StackTraceElement[] traces = t.getStackTrace();
- for (int i = 0; i < traces.length; i++) {
- StackTraceElement trace = traces[i];
- buf.append("\n\tat " + trace);
- if (i == 12)
- break; // Don't dump all stacks
- }
- return buf.toString();
- }
- protected String getElementsAsString(List<? extends Element> list) {
- StringBuilder builder = new StringBuilder("[");
- for (Element element : list) {
- if (element instanceof PackageElement) {
- builder.append(((PackageElement) element).getQualifiedName());
- } else if (element instanceof ModuleElement) {
- builder.append(((ModuleElement) element).getQualifiedName());
- } else if (element instanceof TypeElement) {
- builder.append(((TypeElement) element).getQualifiedName());
- } else {
- builder.append(element.getSimpleName());
- }
- builder.append(", ");
- }
- builder.append("]");
- return builder.toString();
- }
- public void assertModifiers(Set<Modifier> modifiers, String[] expected) {
- assertEquals("Incorrect no of modifiers", modifiers.size(), expected.length);
- Set<String> actual = new HashSet<String>(expected.length);
- for (Modifier modifier : modifiers) {
- actual.add(modifier.toString());
- }
- for(int i = 0, length = expected.length; i < length; i++) {
- boolean result = actual.remove(expected[i]);
- if (!result) reportError("Modifier not present :" + expected[i]);
- }
- if (!actual.isEmpty()) {
- reportError("Unexpected modifiers present:" + actual.toString());
- }
- }
- public void assertTrue(String msg, boolean value) {
- if (!value) reportError(msg);
- }
- public void assertFalse(String msg, boolean value) {
- if (value) reportError(msg);
- }
- public void assertSame(String msg, Object obj1, Object obj2) {
- if (obj1 != obj2) {
- reportError(msg + ", should be " + obj1.toString() + " but " + obj2.toString());
- }
- }
- public void assertNotSame(String msg, Object obj1, Object obj2) {
- if (obj1 == obj2) {
- reportError(msg + ", " + obj1.toString() + " should not be same as " + obj2.toString());
- }
- }
- public void assertNotNull(String msg, Object obj) {
- if (obj == null) {
- reportError(msg);
- }
- }
- public void assertNull(String msg, Object obj) {
- if (obj != null) {
- reportError(msg);
- }
- }
- public void assertEquals(String message, Object expected, Object actual) {
- if (equalsRegardingNull(expected, actual)) {
- return;
- } else {
- reportError(message + ", expected " + expected.toString() + " but was " + actual.toString());
- }
- }
-
- public void assertEquals(String message, Object expected, Object alternateExpected, Object actual) {
- if (equalsRegardingNull(expected, actual) || equalsRegardingNull(alternateExpected, actual)) {
- return;
- } else {
- reportError(message + ", expected " + expected.toString() + " but was " + actual.toString());
- }
- }
-
- static boolean equalsRegardingNull(Object expected, Object actual) {
- if (expected == null) {
- return actual == null;
- }
- return expected.equals(actual);
- }
-
- public void assertEquals(String msg, int expected, int actual) {
- if (expected != actual) {
- StringBuffer buf = new StringBuffer();
- buf.append(msg);
- buf.append(", expected " + expected + " but was " + actual);
- reportError(buf.toString());
- }
- }
- public void assertEquals(Object expected, Object actual) {
- if (expected != actual) {
-
- }
- }
- private void verifyAnnotations(AnnotatedConstruct construct, String[] annots) {
- List<? extends AnnotationMirror> annotations = construct.getAnnotationMirrors();
- assertEquals("Incorrect no of annotations", annots.length, annotations.size());
- for(int i = 0, length = annots.length; i < length; i++) {
- AnnotationMirror mirror = annotations.get(i);
- assertEquals("Invalid annotation value", annots[i], getAnnotationString(mirror));
- }
- }
-
- private String getAnnotationString(AnnotationMirror annot) {
- DeclaredType annotType = annot.getAnnotationType();
- TypeElement type = (TypeElement) annotType.asElement();
- StringBuffer buf = new StringBuffer("@" + type.getSimpleName());
- Map<? extends ExecutableElement, ? extends AnnotationValue> values = annot.getElementValues();
- Set<? extends ExecutableElement> keys = values.keySet();
- buf.append('(');
- for (ExecutableElement executableElement : keys) { // @Marker3()
- buf.append(executableElement.getSimpleName());
- buf.append('=');
- AnnotationValue value = values.get(executableElement);
- buf.append(value.getValue());
- }
- buf.append(')');
- return buf.toString();
- }
- private class AssertionFailedError extends Error {
- private static final long serialVersionUID = 1L;
-
- public AssertionFailedError(String msg) {
- super(msg);
- }
- }
-
- class ScannerImpl<R, P> extends ElementScanner14<R, P> {
- public Object el;
- boolean isType;
- boolean isMethod;
- public boolean visited;
- public boolean scanned;
- R result;
- public Object param;
-
- public List<TypeParameterElement> params = new ArrayList<>();
-
- public ScannerImpl() {
- super();
- }
-
- public ScannerImpl(R r) {
- super(r);
- }
-
- @Override
- public R visitType(TypeElement e, P p) {
- el = e;
- param = p;
- isType = true;
- return super.visitType(e, p);
- }
-
- @Override
- public R visitExecutable(ExecutableElement e, P p) {
- isMethod = true;
- el = e;
- param = p;
- return super.visitExecutable(e, p);
- }
-
- public R visitRecordComponent(RecordComponentElement e, P p) {
- el = e;
- param = p;
- visited = true;
- return super.visitRecordComponent(e, p);
- }
-
- public R scan(Element e, P p) {
- scanned = true;
- if (e instanceof TypeParameterElement) {
- params.add((TypeParameterElement) e);
- }
- return DEFAULT_VALUE;
- }
- }
}
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/SealedTypeElementProcessor.java b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/SealedTypeElementProcessor.java
new file mode 100644
index 0000000000..b3a17cb5a1
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/processors8/org/eclipse/jdt/compiler/apt/tests/processors/elements/SealedTypeElementProcessor.java
@@ -0,0 +1,301 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.compiler.apt.tests.processors.elements;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.NoType;
+import javax.lang.model.type.TypeMirror;
+
+@SupportedAnnotationTypes("*")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class SealedTypeElementProcessor extends BaseElementProcessor {
+ TypeElement nonSealed = null;
+ TypeElement sealed1 = null;
+ Modifier sealed = null;
+ Modifier non_Sealed = null;
+ Modifier modifierStatic = null;
+ Modifier modifierFinal = null;
+ PackageElement topPkg = null;
+ PackageElement topPkg2 = null;
+ PackageElement topPkg3 = null;
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ }
+ public void testAll() throws AssertionFailedError, IOException {
+ test001();
+ test002();
+ test003();
+ test004();
+ test005Src();
+ test005Binary();
+ }
+ private void fetchElements() {
+ Set<? extends Element> elements = roundEnv.getRootElements();
+ for (Element element : elements) {
+ if ("SealedExample".equals(element.getSimpleName().toString())) {
+ nonSealed = (TypeElement) element;
+ } else if ("SealedI1".equals(element.getSimpleName().toString())) {
+ sealed1 = (TypeElement) element;
+ } else if ("TopMain".equals(element.getSimpleName().toString())) {
+ topPkg = (PackageElement) (element.getEnclosingElement());
+ } else if ("TopMain2".equals(element.getSimpleName().toString())) {
+ topPkg2 = (PackageElement) (element.getEnclosingElement());
+ } else if ("TopMain3".equals(element.getSimpleName().toString())) {
+ topPkg3 = (PackageElement) (element.getEnclosingElement());
+ }
+ }
+ try {
+ sealed = Modifier.valueOf("SEALED");
+ non_Sealed = Modifier.valueOf("NON_SEALED");
+ modifierStatic = Modifier.valueOf("STATIC");
+ modifierFinal = Modifier.valueOf("FINAL");
+ } catch(IllegalArgumentException iae) {
+ }
+ }
+ // Test simple sealed and non-sealed type modifier
+ public void test001() {
+ fetchElements();
+ if (sealed == null || non_Sealed == null) {
+ // this will never be the case if the test is run with JRE 15
+ return;
+ }
+ assertNotNull("TypeElement for non sealed type should not be null", nonSealed);
+ assertNotNull("TypeElement for sealed type should not be null", sealed1);
+ Set<Modifier> modifiers = nonSealed.getModifiers();
+ if (!isBinaryMode)
+ assertTrue("should contain modifier \'non-sealed\'", modifiers.contains(non_Sealed));
+ assertFalse("should not contain modifier \'sealed\'", modifiers.contains(sealed));
+ modifiers = sealed1.getModifiers();
+ assertTrue("should contain modifier \'sealed\'", modifiers.contains(sealed));
+ if (!isBinaryMode)
+ assertFalse("should not contain modifier \'non-sealed\'", modifiers.contains(non_Sealed));
+ }
+ // Test getPermittedSubclasses()
+ public void test002() {
+ fetchElements();
+ // The collection returned by asList() doesn't support remove(), hence wrap it in another collection.
+ List<String> list = new ArrayList<String>(Arrays.asList("sealed.SealedExample", "sealed.NonSealed1"));
+ assertNotNull("TypeElement for non sealed type should not be null", nonSealed);
+ assertNotNull("TypeElement for sealed type should not be null", sealed1);
+ List<? extends TypeMirror> permittedSubclasses = sealed1.getPermittedSubclasses();
+ assertEquals("incorrect no of permitted classes", 2, permittedSubclasses.size());
+ for (TypeMirror typeMirror : permittedSubclasses) {
+ list.remove(typeMirror.toString());
+ }
+ assertEquals("missing permitted classes", 0, list.size());
+ }
+ public void test003() {
+ fetchElements();
+ assertNotNull("package null", topPkg);
+ List<? extends Element> enclosedElements = topPkg.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 3, enclosedElements.size());
+ TypeElement sealedType = null;
+ for (Element element : enclosedElements) {
+ if (element instanceof TypeElement) {
+ TypeElement temp = (TypeElement) element;
+ if (temp.getQualifiedName().toString().equals("sealed.sub.TopSecond")) {
+ sealedType = (TypeElement) element;
+ break;
+ }
+ }
+ }
+ assertNotNull("type should not be null", sealedType);
+ List<? extends TypeMirror> permittedSubclasses = sealedType.getPermittedSubclasses();
+ assertEquals("incorrect no of permitted types", 2, permittedSubclasses.size());
+ for (TypeMirror typeMirror : permittedSubclasses) {
+ TypeElement typeEl = (TypeElement) _typeUtils.asElement(typeMirror);
+ if (typeEl.getQualifiedName().toString().equals("sealed.sub.TopThird")) {
+ Set<Modifier> modifiers = typeEl.getModifiers();
+ assertTrue("should contain modifier final", modifiers.contains(modifierFinal));
+ assertFalse("should not contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("should not contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ TypeMirror superclass = typeEl.getSuperclass();
+ assertFalse("should be a valid type", (superclass instanceof NoType));
+ TypeElement temp = (TypeElement) _typeUtils.asElement(superclass);
+ assertNotNull("type element should not be null", temp);
+ assertEquals("incorrect super class", "sealed.sub.TopSecond", temp.getQualifiedName().toString());
+ modifiers = temp.getModifiers();
+ assertTrue("should contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("should not contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier final", modifiers.contains(modifierFinal));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ enclosedElements = temp.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 1, enclosedElements.size());
+ Element element = enclosedElements.get(0);
+ assertEquals("should be a constructor", ElementKind.CONSTRUCTOR, element.getKind());
+ ExecutableElement method = (ExecutableElement) element;
+ assertEquals("incorrect constructor name", "<init>", method.getSimpleName().toString());
+ continue;
+ }
+ if (typeEl.getQualifiedName().toString().equals("sealed.sub.TopThird.NonSealedStaticNested")) {
+ Set<Modifier> modifiers = typeEl.getModifiers();
+ assertTrue("should contain modifier static", modifiers.contains(modifierStatic));
+ if (isBinaryMode)
+ assertFalse("should not contain modifier non-sealed in binary", modifiers.contains(non_Sealed));
+ else
+ assertTrue("should contain modifier non-sealed in source mode", modifiers.contains(non_Sealed));
+ assertFalse("should not contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("should not contain modifier final", modifiers.contains(modifierFinal));
+ TypeMirror superclass = typeEl.getSuperclass();
+ assertFalse("should be a valid type", (superclass instanceof NoType));
+ TypeElement temp = (TypeElement) _typeUtils.asElement(superclass);
+ assertNotNull("type element should not be null", temp);
+ assertEquals("incorrect super class", "sealed.sub.TopSecond", temp.getQualifiedName().toString());
+ modifiers = temp.getModifiers();
+ assertTrue("should contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("should not contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier final", modifiers.contains(modifierFinal));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ enclosedElements = temp.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 1, enclosedElements.size());
+ Element element = enclosedElements.get(0);
+ assertEquals("should be a constructor", ElementKind.CONSTRUCTOR, element.getKind());
+ ExecutableElement method = (ExecutableElement) element;
+ assertEquals("incorrect constructor name", "<init>", method.getSimpleName().toString());
+ continue;
+ }
+ }
+ }
+ public void test004() {
+ fetchElements();
+ assertNotNull("package null", topPkg2);
+ List<? extends Element> enclosedElements = topPkg2.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 1, enclosedElements.size());
+ TypeElement topType = null;
+ for (Element element : enclosedElements) {
+ if (element instanceof TypeElement) {
+ TypeElement temp = (TypeElement) element;
+ if (temp.getQualifiedName().toString().equals("sealed.sub2.TopMain2")) {
+ topType = (TypeElement) element;
+ break;
+ }
+ }
+ }
+ assertNotNull("type should not be null", topType);
+ enclosedElements = topType.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 3, enclosedElements.size());
+
+ for (Element element : enclosedElements) {
+ if (!(element instanceof TypeElement))
+ continue;
+ TypeElement typeEl = (TypeElement) element;
+ if (typeEl.getQualifiedName().toString().equals("sealed.sub2.TopMain2.SealedIntf")) {
+ Set<Modifier> modifiers = typeEl.getModifiers();
+ assertTrue("should contain modifier sealed", modifiers.contains(sealed));
+ assertTrue("should contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier final", modifiers.contains(modifierFinal));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ TypeMirror superclass = typeEl.getSuperclass();
+ assertTrue("should be a NoType", (superclass instanceof NoType));
+ List<? extends TypeMirror> permittedSubclasses = typeEl.getPermittedSubclasses();
+ assertEquals("incorrect no of permitted types", 1, permittedSubclasses.size());
+ for (TypeMirror typeMirror : permittedSubclasses) {
+ TypeElement permittedTypeEl = (TypeElement) _typeUtils.asElement(typeMirror);
+ if (permittedTypeEl.getQualifiedName().toString().equals("sealed.sub2.TopMain2.MyRecord")) {
+ superclass = permittedTypeEl.getSuperclass();
+ modifiers = permittedTypeEl.getModifiers();
+ assertTrue("record should contain modifier final", modifiers.contains(modifierFinal));
+ assertTrue("should contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ assertFalse("should not be a NoType", (superclass instanceof NoType));
+ TypeElement superClassElement = (TypeElement) _typeUtils.asElement(superclass);
+ assertNotNull("type element should not be null", superClassElement);
+ assertEquals("incorrect super class", "java.lang.Record", superClassElement.getQualifiedName().toString());
+ List<? extends TypeMirror> interfaces = permittedTypeEl.getInterfaces();
+ assertEquals("incorrect no of super interfaces", 1, interfaces.size());
+ TypeElement superInterfaceElement = (TypeElement) _typeUtils.asElement(interfaces.get(0));
+ assertEquals("incorrect super interface", "sealed.sub2.TopMain2.SealedIntf", superInterfaceElement.getQualifiedName().toString());
+ modifiers = superInterfaceElement.getModifiers();
+ assertTrue("should contain modifier sealed", modifiers.contains(sealed));
+ assertTrue("should contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier final", modifiers.contains(modifierFinal));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ }
+ }
+ break;
+ }
+ }
+ }
+ public void _test005() {
+ fetchElements();
+ assertNotNull("package null", topPkg3);
+ List<? extends Element> enclosedElements = topPkg3.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 1, enclosedElements.size());
+ TypeElement topType = null;
+ for (Element element : enclosedElements) {
+ if (element instanceof TypeElement) {
+ TypeElement temp = (TypeElement) element;
+ if (temp.getQualifiedName().toString().equals("sealed.sub3.TopMain3")) {
+ topType = (TypeElement) element;
+ break;
+ }
+ }
+ }
+ assertNotNull("type should not be null", topType);
+ enclosedElements = topType.getEnclosedElements();
+ assertEquals("incorrect no of enclosed elements", 4, enclosedElements.size());
+ TypeElement sealedIntf = null;
+ TypeElement enumElement = null;
+ for (Element element : enclosedElements) {
+ if (!(element instanceof TypeElement))
+ continue;
+ TypeElement typeEl = (TypeElement) element;
+ Set<Modifier> modifiers = null;
+ if (typeEl.getQualifiedName().toString().equals("sealed.sub3.TopMain3.SealedIntf")) {
+ sealedIntf = typeEl;
+ modifiers = typeEl.getModifiers();
+ assertTrue("should contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("should not contain modifier final", modifiers.contains(modifierFinal));
+ assertTrue("should contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ } else if (typeEl.getQualifiedName().toString().equals("sealed.sub3.TopMain3.MyEnum")) {
+ enumElement = typeEl;
+ modifiers = typeEl.getModifiers();
+ assertTrue("should contain modifier sealed", modifiers.contains(sealed));
+ assertFalse("enum should not contain modifier final", modifiers.contains(modifierFinal));
+ assertTrue("should contain modifier static", modifiers.contains(modifierStatic));
+ assertFalse("should not contain modifier non-sealed", modifiers.contains(non_Sealed));
+ }
+ }
+ assertNotNull("type element should not null", sealedIntf);
+ assertNotNull("type element should not null", enumElement);
+ }
+ public void test005Src() {
+ if (this.isBinaryMode) return;
+ _test005();
+ }
+ public void test005Binary() {
+ if (!this.isBinaryMode) return;
+ _test005();
+ }
+}
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/MyAnnot.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/MyAnnot.java
index 5aea36cca6..9e6bb650a6 100644
--- a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/MyAnnot.java
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/MyAnnot.java
@@ -5,7 +5,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-@Target({ElementType.RECORD_COMPONENT, ElementType.TYPE})
+@Target({ElementType.RECORD_COMPONENT, ElementType.TYPE, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@interface MyAnnot {}
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/Point.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/Point.java
index aa89893143..4b8205e95a 100644
--- a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/Point.java
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/records/mod.records/records/Point.java
@@ -2,13 +2,12 @@ package records;
@Deprecated
public record Point(@MyAnnot int comp_,
@MyAnnot2 int comp2_,
- @MyAnnot3 int comp3_,
+ @MyAnnot3 @MyAnnot5 int comp3_,
@MyAnnot4 int comp4_,
@MyAnnot5 int comp5_) {
private static String field1;
public static double field2;
protected static Character field3;
- public Point {}
public boolean equals(Object o) {
return false;
}
@@ -18,4 +17,4 @@ public record Point(@MyAnnot int comp_,
public String toString() {
return null;
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/module-info.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/module-info.java
new file mode 100644
index 0000000000..380b8555c5
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/module-info.java
@@ -0,0 +1,3 @@
+module mod.sealed.types {
+}
+
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/SealedExample.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/SealedExample.java
new file mode 100644
index 0000000000..53c592d35c
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/SealedExample.java
@@ -0,0 +1,9 @@
+package sealed;
+@Deprecated
+non-sealed class SealedExample implements SealedI1 {
+ public static void main(String[] args){
+ System.out.println(0);
+ }
+}
+sealed interface SealedI1 permits SealedExample, NonSealed1 {}
+non-sealed class NonSealed1 implements SealedI1 {} \ No newline at end of file
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub/TopMain.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub/TopMain.java
new file mode 100644
index 0000000000..7e85df0c7c
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub/TopMain.java
@@ -0,0 +1,9 @@
+package sealed.sub;
+
+public class TopMain {
+ public static void main(String[] args) {}
+}
+sealed class TopSecond permits TopThird, TopThird.NonSealedStaticNested {}
+final class TopThird extends TopSecond {
+ static non-sealed class NonSealedStaticNested extends TopSecond {}
+}
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub2/TopMain2.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub2/TopMain2.java
new file mode 100644
index 0000000000..8b2a61768b
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub2/TopMain2.java
@@ -0,0 +1,7 @@
+package sealed.sub2;
+
+public class TopMain2 {
+ sealed interface SealedIntf permits MyRecord {}
+ record MyRecord() implements SealedIntf {}
+}
+
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub3/TopMain3.java b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub3/TopMain3.java
new file mode 100644
index 0000000000..31b992a5f1
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/mod_locations/sealed/mod.sealed.types/sealed/sub3/TopMain3.java
@@ -0,0 +1,14 @@
+package sealed.sub3;
+
+public class TopMain3 {
+ TopMain3 top = new TopMain3() {};
+ sealed interface SealedIntf permits MyEnum {}
+ enum MyEnum implements SealedIntf{
+ A {
+ int val() { return 1; }
+ }, B, C;
+ int val() {
+ return 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java
index 17b6ba2e12..fbdc0b3e19 100644
--- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java
+++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/AllTests.java
@@ -37,7 +37,8 @@ public class AllTests extends TestCase {
suite.addTestSuite(Java9ElementsTests.class);
suite.addTestSuite(Java11ElementsTests.class);
suite.addTestSuite(Java12ElementsTests.class);
- suite.addTestSuite(Java14ElementsTests.class);
+ suite.addTestSuite(RecordElementsTests.class);
+ suite.addTestSuite(SealedTypeElementsTests.class);
suite.addTestSuite(AnnotationProcessorTests.class);
return suite;
}
diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java14ElementsTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/RecordElementsTests.java
index 8c5bb9eea1..1d5841881e 100644
--- a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/Java14ElementsTests.java
+++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/RecordElementsTests.java
@@ -19,121 +19,121 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import javax.lang.model.SourceVersion;
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler;
import junit.framework.TestCase;
-public class Java14ElementsTests extends TestCase {
- private static final String MODULE_PROC = "org.eclipse.jdt.compiler.apt.tests.processors.elements.Java14ElementProcessor";
+public class RecordElementsTests extends TestCase {
+ private static final String MODULE_PROC = "org.eclipse.jdt.compiler.apt.tests.processors.elements.RecordElementProcessor";
public void testPreviewFlagTrue() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testPreviewFlagTrue", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testPreviewFlagTrue", null, "records", true);
}
public void testRecords1() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords1", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords1", null, "records", true);
}
public void testRecords1Javac() throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords1", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords1", null, "records", true);
}
public void testRecords2() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords2", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords2", null, "records", true);
}
public void testRecords2Javac() throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords2", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords2", null, "records", true);
}
public void testRecords3() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords3", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords3", null, "records", true);
}
public void testRecords3Javac() throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords3", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords3", null, "records", true);
}
public void testRecords3a() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords3a", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords3a", null, "records", true);
}
public void testRecords3aJavac() throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords3a", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords3a", null, "records", true);
}
public void testRecords4() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords4", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords4", null, "records", true);
}
public void testRecords4Javac() throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords4", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords4", null, "records", true);
}
public void testRecords4a() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords4a", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords4a", null, "records", true);
}
public void testRecords4aJavac() throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords4a", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords4a", null, "records", true);
}
public void testRecords5() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords5", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords5", null, "records", true);
}
public void testRecords5Javac() throws IOException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords5", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords5", null, "records", true);
}
public void testRecords5a() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords5a", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords5a", null, "records", true);
}
public void testRecords5aJavac() throws IOException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords5a", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords5a", null, "records", true);
}
public void testRecords6() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords6", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords6", null, "records", true);
}
public void testRecords6Javac() throws IOException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords6", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords6", null, "records", true);
}
public void testRecords7() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords7", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords7", null, "records", true);
}
public void testRecords7Javac() throws IOException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords7", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords7", null, "records", true);
}
public void testRecords8() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords8", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords8", null, "records", true);
}
public void testRecords8Javac() throws IOException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords8", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords8", null, "records", true);
}
public void testRecords9() throws IOException {
JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords9", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords9", null, "records", true);
}
public void testRecords9Javac() throws IOException {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- internalTestWithPreview(compiler, MODULE_PROC, "14", "testRecords9", null, "records", true);
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "testRecords9", null, "records", true);
}
protected void internalTestWithPreview(JavaCompiler compiler, String processor, String compliance,
String testMethod, String testClass, String resourceArea, boolean preview) throws IOException {
- if (!canRunJava14()) {
+ if (!isRunning15()) {
return;
}
System.clearProperty(processor);
@@ -162,13 +162,9 @@ public class Java14ElementsTests extends TestCase {
// if not, it will set it to an error value.
assertEquals("succeeded", System.getProperty(processor));
}
- public boolean canRunJava14() {
- try {
- SourceVersion.valueOf("RELEASE_14");
- } catch(IllegalArgumentException iae) {
- return false;
- }
- return true;
+ public boolean isRunning15() {
+ String specVersion = System.getProperty("java.specification.version");
+ return CompilerOptions.VERSION_15.equals(specVersion);
}
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
diff --git a/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/SealedTypeElementsTests.java b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/SealedTypeElementsTests.java
new file mode 100644
index 0000000000..952c02002a
--- /dev/null
+++ b/org.eclipse.jdt.compiler.apt.tests/src/org/eclipse/jdt/compiler/apt/tests/SealedTypeElementsTests.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.compiler.apt.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.lang.model.SourceVersion;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler;
+
+import junit.framework.TestCase;
+
+public class SealedTypeElementsTests extends TestCase {
+ private static final String MODULE_PROC = "org.eclipse.jdt.compiler.apt.tests.processors.elements.SealedTypeElementProcessor";
+
+ public void test001() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test001", null, "sealed", true);
+ }
+ public void test001Javac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test001", null, "sealed", true);
+ }
+ public void test002() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test002", null, "sealed", true);
+ }
+ public void test002Javac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test002", null, "sealed", true);
+ }
+ public void test003() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test003", null, "sealed", true);
+ }
+ public void test003Javac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test003", null, "sealed", true);
+ }
+ public void test004() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test004", null, "sealed", true);
+ }
+ public void test004Javac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test004", null, "sealed", true);
+ }
+ public void test005Src() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test005Src", null, "sealed", true);
+ }
+ public void test005SrcJavac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test005Src", null, "sealed", true);
+ }
+ public void test005Binary() throws IOException {
+ JavaCompiler compiler = BatchTestUtils.getEclipseCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test005Binary", null, "sealed", true);
+ }
+ public void test005BinaryJavac() throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ internalTestWithPreview(compiler, MODULE_PROC, "15", "test005Binary", null, "sealed", true);
+ }
+
+ protected void internalTestWithPreview(JavaCompiler compiler, String processor, String compliance,
+ String testMethod, String testClass, String resourceArea, boolean preview) throws IOException {
+ if (!canRunJava15()) {
+ return;
+ }
+ System.clearProperty(processor);
+ File targetFolder = TestUtils.concatPath(BatchTestUtils.getSrcFolderName(), "mod_locations", resourceArea);
+ if (testClass == null || testClass.equals("")) {
+ BatchTestUtils.copyResources("mod_locations/" + resourceArea, targetFolder);
+ } else {
+ BatchTestUtils.copyResource("mod_locations/" + resourceArea + "/" + testClass, targetFolder);
+ }
+
+ List<String> options = new ArrayList<String>();
+ options.add("-A" + processor);
+ options.add("-A" + testMethod);
+ options.add("-processor");
+ options.add(processor);
+ if (compiler instanceof EclipseCompiler) {
+ options.add("-" + compliance);
+ } else {
+ options.add("-source");
+ options.add(compliance);
+ }
+ if (preview)
+ options.add("--enable-preview");
+ BatchTestUtils.compileInModuleMode(compiler, options, processor, targetFolder, null, true, true);
+ // If it succeeded, the processor will have set this property to "succeeded";
+ // if not, it will set it to an error value.
+ assertEquals("succeeded", System.getProperty(processor));
+ }
+ public boolean canRunJava15() {
+ try {
+ SourceVersion.valueOf("RELEASE_15");
+ } catch(IllegalArgumentException iae) {
+ return false;
+ }
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ BatchTestUtils.init();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.compiler.apt/build.properties b/org.eclipse.jdt.compiler.apt/build.properties
index 13410ff307..59281ddbf0 100644
--- a/org.eclipse.jdt.compiler.apt/build.properties
+++ b/org.eclipse.jdt.compiler.apt/build.properties
@@ -22,4 +22,4 @@ jars.compile.order = .
output.. = bin/
source.. = src/
-jars.extra.classpath = lib/java14api.jar
+jars.extra.classpath = lib/javax15api.jar
diff --git a/org.eclipse.jdt.compiler.tool.tests/lib/java14api.jar b/org.eclipse.jdt.compiler.apt/lib/javax15api.jar
index e24da08002..c451cc2ba9 100644
--- a/org.eclipse.jdt.compiler.tool.tests/lib/java14api.jar
+++ b/org.eclipse.jdt.compiler.apt/lib/javax15api.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
index 7da02a610c..6dd97c60af 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
@@ -153,6 +153,9 @@ public abstract class BaseProcessingEnvImpl implements ProcessingEnvironment {
if (this._compiler.options.sourceLevel == ClassFileConstants.JDK14) {
return SourceVersion.valueOf("RELEASE_14"); //$NON-NLS-1$
}
+ if (this._compiler.options.sourceLevel == ClassFileConstants.JDK15) {
+ return SourceVersion.valueOf("RELEASE_15"); //$NON-NLS-1$
+ }
} catch(IllegalArgumentException e) {
// handle call on a JDK 6
return SourceVersion.RELEASE_6;
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
index 8f96ee3816..b3a40e4ae9 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
@@ -204,6 +204,20 @@ public class Factory {
case ClassFileConstants.AccVolatile :
appendModifier(result, modifiers, checkBits[i], Modifier.VOLATILE);
break;
+ case ExtraCompilerModifiers.AccNonSealed :
+ try {
+ appendModifier(result, modifiers, checkBits[i], Modifier.valueOf("NON_SEALED")); //$NON-NLS-1$
+ } catch(IllegalArgumentException iae) {
+ // Don't have JDK 15, just ignore and proceed.
+ }
+ break;
+ case ExtraCompilerModifiers.AccSealed :
+ try {
+ appendModifier(result, modifiers, checkBits[i], Modifier.valueOf("SEALED")); //$NON-NLS-1$
+ } catch(IllegalArgumentException iae) {
+ // Don't have JDK 15, just ignore and proceed.
+ }
+ break;
}
}
}
@@ -295,7 +309,8 @@ public class Factory {
ClassFileConstants.AccPrivate,
ClassFileConstants.AccAbstract,
ClassFileConstants.AccStatic,
- ClassFileConstants.AccStrictfp
+ ClassFileConstants.AccStrictfp,
+ ExtraCompilerModifiers.AccSealed,
});
} else {
// enum from source cannot be explicitly abstract
@@ -305,7 +320,8 @@ public class Factory {
ClassFileConstants.AccFinal,
ClassFileConstants.AccPrivate,
ClassFileConstants.AccStatic,
- ClassFileConstants.AccStrictfp
+ ClassFileConstants.AccStrictfp,
+ ExtraCompilerModifiers.AccSealed,
});
}
break;
@@ -321,7 +337,9 @@ public class Factory {
ClassFileConstants.AccFinal,
ClassFileConstants.AccPrivate,
ClassFileConstants.AccStatic,
- ClassFileConstants.AccStrictfp
+ ClassFileConstants.AccStrictfp,
+ ExtraCompilerModifiers.AccSealed,
+ ExtraCompilerModifiers.AccNonSealed
});
break;
case MODULE :
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java
index 4a356e3489..79a2bd546f 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/PackageElementImpl.java
@@ -82,7 +82,8 @@ public class PackageElementImpl extends ElementImpl implements PackageElement {
for (char[][] typeName : typeNames) {
if (typeName == null) continue;
ReferenceBinding type = environment.getType(typeName);
- if (type != null && type.isValidBinding()) {
+ if (type == null || type.isMemberType()) continue;
+ if (type.isValidBinding()) {
Element newElement = _env.getFactory().newElement(type);
if (newElement.getKind() != ElementKind.PACKAGE) {
set.add(newElement);
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java
index d2dfd2175d..9ab644d780 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java
@@ -198,6 +198,19 @@ public class TypeElementImpl extends ElementImpl implements TypeElement {
}
@Override
+ public List<? extends TypeMirror> getPermittedSubclasses() {
+ ReferenceBinding binding = (ReferenceBinding)_binding;
+ if (binding.isSealed()) {
+ List<TypeMirror> permitted = new ArrayList<>();
+ for (ReferenceBinding type : binding.permittedTypes()) {
+ TypeMirror typeMirror = _env.getFactory().newTypeMirror(type);
+ permitted.add(typeMirror);
+ }
+ return Collections.unmodifiableList(permitted);
+ }
+ return Collections.emptyList();
+ }
+ @Override
public Element getEnclosingElement() {
ReferenceBinding binding = (ReferenceBinding)_binding;
ReferenceBinding enclosingType = binding.enclosingType();
@@ -275,6 +288,7 @@ public class TypeElementImpl extends ElementImpl implements TypeElement {
if (refBinding.isInterface() && refBinding.isNestedType()) {
modifiers |= ClassFileConstants.AccStatic;
}
+
return Factory.getModifiers(modifiers, getKind(), refBinding.isBinaryBinding());
}
diff --git a/org.eclipse.jdt.compiler.tool.tests/.classpath b/org.eclipse.jdt.compiler.tool.tests/.classpath
index 64151d68fb..0d1d3b3649 100644
--- a/org.eclipse.jdt.compiler.tool.tests/.classpath
+++ b/org.eclipse.jdt.compiler.tool.tests/.classpath
@@ -6,7 +6,7 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="lib/java14api.jar"/>
+ <classpathentry kind="lib" path="lib/javax15api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
index efe7d2ec2a..e64e12b710 100644
--- a/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.compiler.tool.tests/META-INF/MANIFEST.MF
@@ -16,5 +16,5 @@ Export-Package: org.eclipse.jdt.compiler.tool.tests
Import-Package: org.eclipse.jdt.internal.compiler.tool
Eclipse-BundleShape: dir
Bundle-ClassPath: .,
- lib/java14api.jar
+ lib/javax15api.jar
Automatic-Module-Name: org.eclipse.jdt.compiler.tool.tests
diff --git a/org.eclipse.jdt.compiler.tool.tests/build.properties b/org.eclipse.jdt.compiler.tool.tests/build.properties
index ce4f630cd3..1ae25c679e 100644
--- a/org.eclipse.jdt.compiler.tool.tests/build.properties
+++ b/org.eclipse.jdt.compiler.tool.tests/build.properties
@@ -22,4 +22,4 @@ bin.includes = META-INF/,\
src.includes = about.html
source.. = src/
output.. = bin/
-jars.extra.classpath = lib/java14api.jar
+jars.extra.classpath = lib/javax15api.jar
diff --git a/org.eclipse.jdt.compiler.tool/lib/java14api.jar b/org.eclipse.jdt.compiler.tool.tests/lib/javax15api.jar
index e24da08002..c451cc2ba9 100644
--- a/org.eclipse.jdt.compiler.tool/lib/java14api.jar
+++ b/org.eclipse.jdt.compiler.tool.tests/lib/javax15api.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.tool.tests/resources/module_locations/bug566749/mod.test/module-info.java b/org.eclipse.jdt.compiler.tool.tests/resources/module_locations/bug566749/mod.test/module-info.java
new file mode 100644
index 0000000000..15d055b50f
--- /dev/null
+++ b/org.eclipse.jdt.compiler.tool.tests/resources/module_locations/bug566749/mod.test/module-info.java
@@ -0,0 +1,2 @@
+module open {
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolJava9Tests.java b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolJava9Tests.java
index 17fa708b92..30e0ba715a 100644
--- a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolJava9Tests.java
+++ b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolJava9Tests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -671,6 +667,47 @@ public class CompilerToolJava9Tests extends TestCase {
assertTrue("Compilation did not fail ", false);
}
}
+ public void testBug566749() throws IOException {
+ if (this.isJREBelow9) return;
+ JavaCompiler compiler = this.compilers[1];
+ String tmpFolder = _tmpFolder;
+ StandardJavaFileManager manager = compiler.getStandardFileManager(null, Locale.getDefault(), Charset.defaultCharset());
+
+ // create new list containing input file
+ List<File> files = new ArrayList<File>();
+ files.add(new File(modules_directory + File.separator + "bug566749" + File.separator +
+ "mod.test" + File.separator + "module-info.java"));
+
+ Iterable<? extends JavaFileObject> units = manager.getJavaFileObjectsFromFiles(files);
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+
+ List<String> options = new ArrayList<String>();
+ options = new ArrayList<String>();
+ options.add("-d");
+ options.add(tmpFolder);
+ options.add("--module-path");
+ options.add(tmpFolder);
+ options.add("--module-source-path");
+ options.add(modules_directory + File.separator + "bug566749");
+ ByteArrayOutputStream errBuffer = new ByteArrayOutputStream();
+ PrintWriter err = new PrintWriter(errBuffer);
+ CompilerInvocationDiagnosticListener listener = new CompilerInvocationDiagnosticListener(err) {
+ @Override
+ public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+ super.report(diagnostic);
+ }
+ };
+ CompilationTask task = compiler.getTask(printWriter, manager, listener, options, null, units);
+ // check the classpath location
+ Boolean result = task.call();
+ printWriter.flush();
+ printWriter.close();
+ if (result.booleanValue()) {
+ System.err.println("Compilation did not fail as expected: " + stringWriter.getBuffer().toString());
+ assertTrue("Compilation did not fail as expected ", false);
+ }
+ }
public void testGetJavaFileObjects() {
if (this.isJREBelow9) return;
}
diff --git a/org.eclipse.jdt.compiler.tool/.classpath b/org.eclipse.jdt.compiler.tool/.classpath
index e71451ab4d..d3eb90a494 100644
--- a/org.eclipse.jdt.compiler.tool/.classpath
+++ b/org.eclipse.jdt.compiler.tool/.classpath
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="lib/java14api.jar"/>
+ <classpathentry kind="lib" path="lib/javax15api.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF b/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF
index 5df5c21243..344b6d0247 100644
--- a/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.compiler.tool/META-INF/MANIFEST.MF
@@ -9,6 +9,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: META-INF.services,
org.eclipse.jdt.internal.compiler.tool;x-internal:=true
Fragment-Host: org.eclipse.jdt.core;bundle-version="[3.3.0,4.0.0)"
-Bundle-ClassPath: lib/java14api.jar,
+Bundle-ClassPath: lib/javax15api.jar,
.
Automatic-Module-Name: org.eclipse.jdt.compiler.tool
diff --git a/org.eclipse.jdt.compiler.tool/build.properties b/org.eclipse.jdt.compiler.tool/build.properties
index 862d4e462a..d813e13999 100644
--- a/org.eclipse.jdt.compiler.tool/build.properties
+++ b/org.eclipse.jdt.compiler.tool/build.properties
@@ -18,6 +18,6 @@ bin.includes = META-INF/,\
.,\
about.html,\
compiler_tool_fragment.properties,\
- lib/java14api.jar
+ lib/javax15api.jar
src.includes = about.html
-jars.extra.classpath = lib/java14api.jar \ No newline at end of file
+jars.extra.classpath = lib/javax15api.jar \ No newline at end of file
diff --git a/org.eclipse.jdt.compiler.apt/lib/java14api.jar b/org.eclipse.jdt.compiler.tool/lib/javax15api.jar
index e24da08002..c451cc2ba9 100644
--- a/org.eclipse.jdt.compiler.apt/lib/java14api.jar
+++ b/org.eclipse.jdt.compiler.tool/lib/javax15api.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java b/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java
index 594a2fc8c1..d163737852 100644
--- a/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java
+++ b/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java
@@ -612,8 +612,12 @@ public class EclipseCompilerImpl extends Main {
}
fileSystemClasspaths.addAll(modulepaths);
}
+ } catch (IllegalStateException e) {
+ // Ignore this as JRE 9 throws IllegalStateException for getLocation returning null
+ } catch (IllegalArgumentException e) {
+ throw e;
} catch (Exception e) {
- // TODO: Revisit when JRE 9 no longer throws IllegalStateException for getLocation.
+ this.logger.logException(e);
}
try {
locationFiles = standardJavaFileManager.getLocation(StandardLocation.MODULE_PATH);
@@ -635,8 +639,12 @@ public class EclipseCompilerImpl extends Main {
}
}
}
+ } catch (IllegalStateException e) {
+ // Ignore this as JRE 9 throws IllegalStateException for getLocation returning null
+ } catch (IllegalArgumentException e) {
+ throw e;
} catch (Exception e) {
- // TODO: Revisit when JRE 9 no longer throws IllegalStateException for getLocation.
+ this.logger.logException(e);
}
}
} else if (javaFileManager != null) {
diff --git a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
index 6fcc4ffd02..fa6a80b791 100644
--- a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.compiler;singleton:=true
-Bundle-Version: 3.12.1300.qualifier
+Bundle-Version: 3.12.1350.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests.compiler,
diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml
index 644378fcdf..9e969116bd 100644
--- a/org.eclipse.jdt.core.tests.compiler/pom.xml
+++ b/org.eclipse.jdt.core.tests.compiler/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
+ Copyright (c) 2012, 2020 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.compiler</artifactId>
- <version>3.12.1300-SNAPSHOT</version>
+ <version>3.12.1350-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
@@ -169,7 +169,7 @@
<tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,12</tycho.surefire.argLine>
</properties>
</profile>
- <profile>
+ <profile>
<id>test-on-javase-13</id>
<build>
<plugins>
@@ -229,6 +229,36 @@
<tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,13,14</tycho.surefire.argLine>
</properties>
</profile>
+ <profile>
+ <id>test-on-javase-15</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-toolchains-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>toolchain</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <toolchains>
+ <jdk>
+ <id>JavaSE-15</id>
+ </jdk>
+ </toolchains>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,14,15</tycho.surefire.argLine>
+ </properties>
+ </profile>
</profiles>
</project>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
index cae738d087..2eabdf01ff 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
@@ -441,8 +441,6 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
}
- public void enterRecordComponent(RecordComponentInfo recordComponentInfo) {
- }
public void enterInitializer(int declarationStart, int modifiers) {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
index 593174eedc..3cb88f3408 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
@@ -246,30 +246,29 @@ public void enterConstructor(MethodInfo methodInfo) {
enterAbtractMethod(methodInfo);
}
public void enterField(FieldInfo fieldInfo) {
- this.currentType.addField(
- this.currentField =
- new SourceField(
- fieldInfo.declarationStart,
- fieldInfo.modifiers,
- fieldInfo.type,
- fieldInfo.name,
- fieldInfo.nameSourceStart,
- fieldInfo.nameSourceEnd,
- this.source));
-
-}
-public void enterRecordComponent(RecordComponentInfo compInfo) {
- this.currentType.addRecordComponent(
- this.currentRecordComp =
- new SourceField(
- compInfo.declarationStart,
- compInfo.modifiers,
- compInfo.type,
- compInfo.name,
- compInfo.nameSourceStart,
- compInfo.nameSourceEnd,
- this.source));
-
+ if (fieldInfo.isRecordComponent) {
+ this.currentType.addRecordComponent(
+ this.currentRecordComp =
+ new SourceField(
+ fieldInfo.declarationStart,
+ fieldInfo.modifiers,
+ fieldInfo.type,
+ fieldInfo.name,
+ fieldInfo.nameSourceStart,
+ fieldInfo.nameSourceEnd,
+ this.source));
+ } else {
+ this.currentType.addField(
+ this.currentField =
+ new SourceField(
+ fieldInfo.declarationStart,
+ fieldInfo.modifiers,
+ fieldInfo.type,
+ fieldInfo.name,
+ fieldInfo.nameSourceStart,
+ fieldInfo.nameSourceEnd,
+ this.source));
+ }
}
public void enterInitializer(int declarationSourceStart, int modifiers) {
this.currentType.addField(
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
index d20ccdd71c..b87490630b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -252,6 +252,28 @@ public static TestSuite getTestSuite(boolean addComplianceDiagnoseTest) {
TestCase.RUN_ONLY_ID = null;
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14), tests_14));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_15) != 0) {
+ ArrayList tests_15 = (ArrayList)testClasses.clone();
+ tests_15.addAll(TEST_CLASSES_1_5);
+ tests_15.add(ParserTest1_7.class);
+ tests_15.add(LambdaExpressionSyntaxTest.class);
+ tests_15.add(ReferenceExpressionSyntaxTest.class);
+ tests_15.add(TypeAnnotationSyntaxTest.class);
+ tests_15.add(CompletionParserTest18.class);
+ tests_15.add(SelectionParserTest18.class);
+ tests_15.add(SelectionParserTest9.class);
+ tests_15.add(SelectionParserTest10.class);
+ tests_15.add(SelectionParserTest12.class);
+ tests_15.add(ModuleDeclarationSyntaxTest.class);
+ tests_15.add(JEP286ReservedWordTest.class);
+ // Reset forgotten subsets tests
+ TestCase.TESTS_PREFIX = null;
+ TestCase.TESTS_NAMES = null;
+ TestCase.TESTS_NUMBERS= null;
+ TestCase.TESTS_RANGE = null;
+ TestCase.RUN_ONLY_ID = null;
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15), tests_15));
+ }
return all;
}
public static Test suite() {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java
index fda10faada..6287d57867 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java
@@ -89,7 +89,6 @@ public void enterConstructor(MethodInfo methodInfo) {}
* enterField method comment.
*/
public void enterField(FieldInfo fieldInfo) {}
-public void enterRecordComponent(RecordComponentInfo recordComponentInfo) {}
/**
* enterMethod method comment.
*/
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 335bf6ab3a..5816ad808a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -307,6 +307,8 @@ static class JavacCompiler {
return JavaCore.VERSION_13;
} else if(rawVersion.startsWith("14")) {
return JavaCore.VERSION_14;
+ } else if(rawVersion.startsWith("15")) {
+ return JavaCore.VERSION_15;
} else {
throw new RuntimeException("unknown javac version: " + rawVersion);
}
@@ -462,6 +464,20 @@ static class JavacCompiler {
return 0200;
}
}
+ if (version == JavaCore.VERSION_15) {
+ if ("15-ea".equals(rawVersion)) {
+ return 0000;
+ }
+ if ("15".equals(rawVersion)) {
+ return 0000;
+ }
+ if ("15.0.1".equals(rawVersion)) {
+ return 0100;
+ }
+ if ("15.0.2".equals(rawVersion)) {
+ return 0200;
+ }
+ }
throw new RuntimeException("unknown raw javac version: " + rawVersion);
}
// returns 0L if everything went fine; else the lower word contains the
@@ -1202,7 +1218,7 @@ protected static class JavacTestOptions {
public final static String MODULE_INFO_NAME = new String(TypeConstants.MODULE_INFO_NAME);
public static boolean SHIFT = false;
- public static String PREVIEW_ALLOWED_LEVEL = JavaCore.VERSION_14;
+ public static String PREVIEW_ALLOWED_LEVEL = JavaCore.VERSION_15;
protected static final String SOURCE_DIRECTORY = Util.getOutputDirectory() + File.separator + "source";
@@ -1215,7 +1231,7 @@ protected static class JavacTestOptions {
super(name);
}
protected boolean checkPreviewAllowed() {
- return this.complianceLevel == ClassFileConstants.JDK14;
+ return this.complianceLevel == ClassFileConstants.JDK15;
}
protected void checkClassFile(String className, String source, String expectedOutput) throws ClassFormatException, IOException {
this.checkClassFile("", className, source, expectedOutput, ClassFileBytesDisassembler.SYSTEM);
@@ -1396,6 +1412,8 @@ protected static class JavacTestOptions {
int major = (int)(this.complianceLevel>>16);
buffer.append("\" -" + (major - ClassFileConstants.MAJOR_VERSION_0));
}
+ if (this.complianceLevel == ClassFileConstants.getLatestJDKLevel() && this.enablePreview)
+ buffer.append(" --enable-preview ");
buffer
.append(" -preserveAllLocals -proceedOnError -nowarn -g -classpath \"")
.append(Util.getJavaClassLibsAsString())
@@ -3770,6 +3788,52 @@ protected void runNegativeTest(
// javac options
javacTestOptions /* javac test options */);
}
+//runNegativeTest(
+//// test directory preparation
+//new String[] { /* test files */
+//},
+//null /* no test files */,
+//// compiler results
+//"----------\n" + /* expected compiler log */
+//// javac options
+//JavacTestOptions.SKIP /* skip javac tests */);
+//JavacTestOptions.DEFAULT /* default javac test options */);
+//javacTestOptions /* javac test options */);
+protected void runNegativeTest(
+// test directory preparation
+String[] testFiles,
+String[] dependentFiles,
+// compiler results
+String expectedCompilerLog,
+// javac options
+JavacTestOptions javacTestOptions) {
+ runTest(
+ // test directory preparation
+ true /* flush output directory */,
+ testFiles /* test files */,
+ dependentFiles,
+ // compiler options
+ null /* no class libraries */,
+ false,
+ null /* no custom options */,
+ false /* do not perform statements recovery */,
+ null /* no custom requestor */,
+ // compiler results
+ true /* expecting compiler errors */,
+ expectedCompilerLog /* expected compiler log */,
+ // runtime options
+ null,
+ false /* do not force execution */,
+ null /* no vm arguments */,
+ // runtime results
+ null /* do not check output string */,
+ null /* do not check error string */,
+ null,
+ null,
+ // javac options
+ javacTestOptions /* javac test options */,
+ Charset.defaultCharset());
+}
// runNegativeTest(
// // test directory preparation
// true /* flush output directory */,
@@ -4017,9 +4081,9 @@ protected void runNegativeTest(
}
protected Map<String, String> setPresetPreviewOptions() {
Map<String, String> options = getCompilerOptions();
- options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
- options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
- options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
options.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
return options;
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java
index 909cc99731..bbb2bce8e7 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -3776,6 +3776,10 @@ public void test123() {
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155255 - variation
public void test124() {
+ String specVersion = System.getProperty("java.specification.version");
+ isJRE15Plus = Integer.valueOf(specVersion) >= Integer.valueOf(CompilerOptions.VERSION_15);
+ String bounds = isJRE15Plus ? "Object&Serializable&Comparable<?>&Constable" : "Object&Serializable&Comparable<?>";
+
this.runNegativeTest(
new String[] {
"X.java",
@@ -3802,7 +3806,7 @@ public void test124() {
"1. ERROR in X.java (at line 3)\n" +
" boolean x = false ? \"\" : false;\n" +
" ^^^^^^^^^^^^^^^^^^\n" +
- "Type mismatch: cannot convert from Object&Serializable&Comparable<?> to boolean\n" +
+ "Type mismatch: cannot convert from "+ bounds +" to boolean\n" +
"----------\n" +
"2. WARNING in X.java (at line 3)\n" +
" boolean x = false ? \"\" : false;\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index bd2e14871e..18c65befb9 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -674,9 +674,10 @@ public void test012(){
" -12 -12.0 use 12 compliance (-source 12 -target 12)\n" +
" -13 -13.0 use 13 compliance (-source 13 -target 13)\n" +
" -14 -14.0 use 14 compliance (-source 14 -target 14)\n" +
- " -source <version> set source level: 1.3 to 1.9, 10 to 14\n" +
+ " -15 -15.0 use 15 compliance (-source 15 -target 15)\n" +
+ " -source <version> set source level: 1.3 to 1.9, 10 to 15\n" +
" (or 6, 6.0, etc)\n" +
- " -target <version> set classfile target: 1.3 to 1.9, 10 to 14\n" +
+ " -target <version> set classfile target: 1.3 to 1.9, 10 to 15\n" +
" (or 6, 6.0, etc)\n" +
" cldc1.1 can also be used to generate the StackMap\n" +
" attribute\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java
new file mode 100644
index 0000000000..de0b950662
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2018, 2020 IBM Corporation.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.util.Util;
+import junit.framework.Test;
+
+@SuppressWarnings({ "rawtypes" })
+public class BatchCompilerTest_15 extends AbstractBatchCompilerTest {
+
+ static {
+// TESTS_NAMES = new String[] { "test440477" };
+// TESTS_NUMBERS = new int[] { 306 };
+// TESTS_RANGE = new int[] { 298, -1 };
+ }
+
+ /**
+ * This test suite only needs to be run on one compliance.
+ * As it includes some specific 1.5 tests, it must be used with a least a 1.5 VM
+ * and not be duplicated in general test suite.
+ * @see TestAll
+ */
+ public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
+ }
+ public static Class testClass() {
+ return BatchCompilerTest_15.class;
+ }
+ public BatchCompilerTest_15(String name) {
+ super(name);
+ }
+ public void testBug564047_001(){
+ String currentWorkingDirectoryPath = System.getProperty("user.dir");
+ if (currentWorkingDirectoryPath == null) {
+ System.err.println("BatchCompilerTest#testBug564047_001 could not access the current working directory " + currentWorkingDirectoryPath);
+ } else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
+ System.err.println("BatchCompilerTest#testBug564047_001 current working directory is not a directory " + currentWorkingDirectoryPath);
+ } else {
+ String lib1Path = currentWorkingDirectoryPath + File.separator + "lib1.jar";
+ try {
+ Util.createJar(
+ new String[] {
+ "p/Y.java",
+ "package p;\n" +
+ "public sealed class Y permits Z{}",
+ "p/Z.java",
+ "package p;\n" +
+ "public final class Z extends Y{}",
+ },
+ lib1Path,
+ JavaCore.VERSION_15,
+ true);
+ this.runNegativeTest(
+ new String[] {
+ "src/p/X.java",
+ "package p;\n" +
+ "public class X extends Y {\n" +
+ " public static void main(String[] args){\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}",
+ },
+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\""
+ + " -cp " + lib1Path // relative
+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\""
+ + " --release 15 --enable-preview -g -preserveAllLocals"
+ + " -proceedOnError -referenceInfo"
+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
+ "",
+ "----------\n" +
+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 2)\n" +
+ " public class X extends Y {\n" +
+ " ^\n" +
+ "The class X with a sealed direct superclass or a sealed direct superinterface Y should be declared either final, sealed, or non-sealed\n" +
+ "----------\n" +
+ "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 2)\n" +
+ " public class X extends Y {\n" +
+ " ^\n" +
+ "The type X extending a sealed class Y should be a permitted subtype of Y\n" +
+ "----------\n" +
+ "2 problems (2 errors)\n",
+ true);
+ } catch (IOException e) {
+ System.err.println("BatchCompilerTest#testBug563430_001 could not write to current working directory " + currentWorkingDirectoryPath);
+ } finally {
+ new File(lib1Path).delete();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_15.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_15.java
new file mode 100644
index 0000000000..0b104733e0
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_15.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2020 GoPivotal, Inc and others
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
+ * Bug 407191 - [1.8] Binary access support for type annotations
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
+
+@SuppressWarnings({ "rawtypes" })
+public class ClassFileReaderTest_15 extends AbstractRegressionTest {
+ static {
+ }
+
+ public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
+ }
+ public static Class testClass() {
+ return ClassFileReaderTest_15.class;
+ }
+
+ public ClassFileReaderTest_15(String name) {
+ super(name);
+ }
+
+ // Needed to run tests individually from JUnit
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.complianceLevel = ClassFileConstants.JDK15;
+ this.enablePreview = true;
+ }
+
+ public void testBug564227_001() throws Exception {
+ String source =
+ "sealed class X permits Y, Z{\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "final class Y extends X{}\n" +
+ "final class Z extends X{}\n";
+
+ org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source);
+ char[][] permittedSubtypesNames = classFileReader.getPermittedSubtypeNames();
+
+ assertEquals(2, permittedSubtypesNames.length);
+
+ char [][] expected = {"Y".toCharArray(), "Z".toCharArray()};
+ assertTrue(CharOperation.equals(permittedSubtypesNames, expected));
+
+ }
+ public void testBug565782_001() throws Exception {
+ String source =
+ "sealed interface I {}\n"+
+ "enum X implements I {\n"+
+ " ONE {};\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}";
+
+ org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source);
+ char[][] permittedSubtypesNames = classFileReader.getPermittedSubtypeNames();
+
+ assertEquals(1, permittedSubtypesNames.length);
+
+ char [][] expected = {"X$1".toCharArray()};
+ assertTrue(CharOperation.equals(permittedSubtypesNames, expected));
+
+ int modifiers = classFileReader.getModifiers();
+ assertTrue("sealed modifier expected", (modifiers & ExtraCompilerModifiers.AccSealed) != 0);
+ }
+ public void testBug565782_002() throws Exception {
+ String source =
+ "sealed interface I {}\n"+
+ "class X {\n"+
+ " enum E implements I {\n"+
+ " ONE {};\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}";
+
+ org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X.E", "X$E", source);
+ char[][] permittedSubtypesNames = classFileReader.getPermittedSubtypeNames();
+
+ assertEquals(1, permittedSubtypesNames.length);
+
+ char [][] expected = {"X$E$1".toCharArray()};
+ assertTrue(CharOperation.equals(permittedSubtypesNames, expected));
+
+ int modifiers = classFileReader.getModifiers();
+ assertTrue("sealed modifier expected", (modifiers & ExtraCompilerModifiers.AccSealed) != 0);
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index 3bffaba5df..4d631ef860 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -721,6 +721,7 @@ public void test011_problem_categories() {
expectedProblemAttributes.put("JavadocInheritedNameHidesEnclosingTypeName", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocInternalTypeNameProvided", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidMemberTypeQualification", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
+ expectedProblemAttributes.put("JavadocInvalidModuleQualification", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidParamName", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidParamTagName", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidParamTagTypeParameter", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
@@ -1201,6 +1202,7 @@ public void test011_problem_categories() {
expectedProblemAttributes.put("PreviewFeatureUsed", new ProblemAttributes(CategorizedProblem.CAT_COMPLIANCE));
expectedProblemAttributes.put("PreviewFeatureNotSupported", new ProblemAttributes(CategorizedProblem.CAT_COMPLIANCE));
expectedProblemAttributes.put("PreviewFeaturesNotAllowed", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("FeatureNotSupported", new ProblemAttributes(CategorizedProblem.CAT_COMPLIANCE));
expectedProblemAttributes.put("SwitchExpressionsYieldIncompatibleResultExpressionTypes", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("SwitchExpressionsYieldEmptySwitchBlock", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
expectedProblemAttributes.put("SwitchExpressionsYieldNoResultExpression", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
@@ -1232,13 +1234,13 @@ public void test011_problem_categories() {
expectedProblemAttributes.put("RecordNonStaticFieldDeclarationInRecord", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordAccessorMethodHasThrowsClause", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordCanonicalConstructorHasThrowsClause", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
- expectedProblemAttributes.put("RecordCanonicalConstructorShouldBePublic", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("RecordCanonicalConstructorVisibilityReduced", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordMultipleCanonicalConstructors", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordCompactConstructorHasReturnStatement", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordDuplicateComponent", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordIllegalNativeModifierInRecord", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordInstanceInitializerBlockInRecord", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
- expectedProblemAttributes.put("RecordIsAReservedTypeName", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("RestrictedTypeName", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordIllegalAccessorReturnType", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordAccessorMethodShouldNotBeGeneric", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordAccessorMethodShouldBePublic", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
@@ -1253,7 +1255,28 @@ public void test011_problem_categories() {
expectedProblemAttributes.put("RecordIllegalVararg", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordStaticReferenceToOuterLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordCannotDefineRecordInLocalType", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("RecordComponentsCannotHaveModifiers", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("RecordIllegalParameterNameInCanonicalConstructor", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("RecordIllegalExplicitFinalFieldAssignInCompactConstructor", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
expectedProblemAttributes.put("RecordMissingExplicitConstructorCallInNonCanonicalConstructor", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("RecordIllegalStaticModifierForLocalClassOrInterface", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("LocalStaticsIllegalVisibilityModifierForInterfaceLocalType", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedMissingClassModifier", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedDisAllowedNonSealedModifierInClass", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedSuperClassDoesNotPermit", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedSuperInterfaceDoesNotPermit", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedMissingSealedModifier", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedMissingInterfaceModifier", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedDuplicateTypeInPermits", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedNotDirectSuperClass", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedPermittedTypeOutsideOfModule", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedPermittedTypeOutsideOfPackage", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedSealedTypeMissingPermits", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedInterfaceIsSealedAndNonSealed", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedDisAllowedNonSealedModifierInInterface", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedNotDirectSuperInterface", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedLocalDirectSuperTypeSealed", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("SealedAnonymousClassCannotExtendSealedType", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
StringBuffer failures = new StringBuffer();
StringBuffer correctResult = new StringBuffer(70000);
Field[] fields = (iProblemClass = IProblem.class).getFields();
@@ -1745,6 +1768,7 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("JavadocInheritedNameHidesEnclosingTypeName", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocInternalTypeNameProvided", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidMemberTypeQualification", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
+ expectedProblemAttributes.put("JavadocInvalidModuleQualification", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidParamName", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidParamTagName", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocInvalidParamTagTypeParameter", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
@@ -2227,6 +2251,7 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("PreviewFeatureUsed", SKIP);
expectedProblemAttributes.put("PreviewFeatureNotSupported", SKIP);
expectedProblemAttributes.put("PreviewFeaturesNotAllowed", SKIP);
+ expectedProblemAttributes.put("FeatureNotSupported", SKIP);
expectedProblemAttributes.put("SwitchExpressionsYieldIncompatibleResultExpressionTypes", SKIP);
expectedProblemAttributes.put("SwitchExpressionsYieldEmptySwitchBlock", SKIP);
expectedProblemAttributes.put("SwitchExpressionsYieldNoResultExpression", SKIP);
@@ -2258,13 +2283,13 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("RecordNonStaticFieldDeclarationInRecord", SKIP);
expectedProblemAttributes.put("RecordAccessorMethodHasThrowsClause", SKIP);
expectedProblemAttributes.put("RecordCanonicalConstructorHasThrowsClause", SKIP);
- expectedProblemAttributes.put("RecordCanonicalConstructorShouldBePublic", SKIP);
+ expectedProblemAttributes.put("RecordCanonicalConstructorVisibilityReduced", SKIP);
expectedProblemAttributes.put("RecordMultipleCanonicalConstructors", SKIP);
expectedProblemAttributes.put("RecordCompactConstructorHasReturnStatement", SKIP);
expectedProblemAttributes.put("RecordDuplicateComponent", SKIP);
expectedProblemAttributes.put("RecordIllegalNativeModifierInRecord", SKIP);
expectedProblemAttributes.put("RecordInstanceInitializerBlockInRecord", SKIP);
- expectedProblemAttributes.put("RecordIsAReservedTypeName", SKIP);
+ expectedProblemAttributes.put("RestrictedTypeName", SKIP);
expectedProblemAttributes.put("RecordIllegalAccessorReturnType", SKIP);
expectedProblemAttributes.put("RecordAccessorMethodShouldNotBeGeneric", SKIP);
expectedProblemAttributes.put("RecordAccessorMethodShouldBePublic", SKIP);
@@ -2280,6 +2305,28 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("RecordStaticReferenceToOuterLocalVariable",SKIP);
expectedProblemAttributes.put("RecordCannotDefineRecordInLocalType",SKIP);
expectedProblemAttributes.put("RecordMissingExplicitConstructorCallInNonCanonicalConstructor",SKIP);
+ expectedProblemAttributes.put("RecordIllegalStaticModifierForLocalClassOrInterface", SKIP);
+ expectedProblemAttributes.put("RecordComponentsCannotHaveModifiers",SKIP);
+ expectedProblemAttributes.put("RecordIllegalParameterNameInCanonicalConstructor",SKIP);
+ expectedProblemAttributes.put("RecordIllegalExplicitFinalFieldAssignInCompactConstructor",SKIP);
+ expectedProblemAttributes.put("LocalStaticsIllegalVisibilityModifierForInterfaceLocalType",SKIP);
+ expectedProblemAttributes.put("SealedMissingClassModifier", SKIP);
+ expectedProblemAttributes.put("SealedDisAllowedNonSealedModifierInClass", SKIP);
+ expectedProblemAttributes.put("SealedSuperClassDoesNotPermit", SKIP);
+ expectedProblemAttributes.put("SealedSuperInterfaceDoesNotPermit", SKIP);
+ expectedProblemAttributes.put("SealedMissingSealedModifier", SKIP);
+ expectedProblemAttributes.put("SealedMissingInterfaceModifier", SKIP);
+ expectedProblemAttributes.put("SealedDuplicateTypeInPermits", SKIP);
+ expectedProblemAttributes.put("SealedNotDirectSuperClass", SKIP);
+ expectedProblemAttributes.put("SealedPermittedTypeOutsideOfModule", SKIP);
+ expectedProblemAttributes.put("SealedPermittedTypeOutsideOfPackage", SKIP);
+ expectedProblemAttributes.put("SealedSealedTypeMissingPermits", SKIP);
+ expectedProblemAttributes.put("SealedInterfaceIsSealedAndNonSealed", SKIP);
+ expectedProblemAttributes.put("SealedDisAllowedNonSealedModifierInInterface", SKIP);
+ expectedProblemAttributes.put("SealedSuperInterfaceDoesNotPermit", SKIP);
+ expectedProblemAttributes.put("SealedNotDirectSuperInterface", SKIP);
+ expectedProblemAttributes.put("SealedLocalDirectSuperTypeSealed", SKIP);
+ expectedProblemAttributes.put("SealedAnonymousClassCannotExtendSealedType", SKIP);
Map constantNamesIndex = new HashMap();
Field[] fields = JavaCore.class.getFields();
for (int i = 0, length = fields.length; i < length; i++) {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index 47beae1a92..d1ddc6b84a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -56,7 +56,7 @@ public class GenericTypeTest extends AbstractComparableTest {
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which does not belong to the class are skipped...
static {
-// TESTS_NAMES = new String[] { "test1277" };
+// TESTS_NAMES = new String[] { "test0593" };
// TESTS_NUMBERS = new int[] { 470, 627 };
// TESTS_RANGE = new int[] { 1097, -1 };
}
@@ -5401,7 +5401,7 @@ public class GenericTypeTest extends AbstractComparableTest {
customOptions);
}
public void test0178a() {
- if (this.complianceLevel < ClassFileConstants.JDK14)
+ if (this.complianceLevel < ClassFileConstants.JDK15)
return;
Map customOptions = getCompilerOptions();
customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
@@ -5421,7 +5421,7 @@ public class GenericTypeTest extends AbstractComparableTest {
" return t;\n" +
" } else if (t instanceof T) {\n" +
" return t;\n" +
- " } else if (t instanceof X) { // this is allowed since Java 14 as preview feature\n" +
+ " } else if (t instanceof X) { // this is allowed since Java 15 as preview feature\n" +
" return t;\n" +
" }\n" +
" return null;\n" +
@@ -18808,6 +18808,7 @@ X.java:6: name clash: <T#1>foo(Object) and <T#2>foo(Object) have the same erasur
public void test0593() {
Map options = getCompilerOptions();
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.IGNORE);
+ String bounds = isJRE15Plus ? "Object&Serializable&Comparable<?>&Constable" : "Object&Serializable&Comparable<?>";
String xSource =
"import java.util.*;\n" +
"public class X {\n" +
@@ -18824,7 +18825,7 @@ X.java:6: name clash: <T#1>foo(Object) and <T#2>foo(Object) have the same erasur
"1. ERROR in X.java (at line 3)\n" +
" List<Class<?>> classes1 = Arrays.asList(String.class, Boolean.class);\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Type mismatch: cannot convert from List<Class<? extends Object&Serializable&Comparable<?>>> to List<Class<?>>\n" +
+ "Type mismatch: cannot convert from List<Class<? extends " + bounds + ">> to List<Class<?>>\n" +
"----------\n",
null,
true,
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java
index 66e672d6cb..6c933b4793 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java
@@ -5,7 +5,7 @@
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
- *
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -89,6 +89,9 @@ public abstract class JavadocTest extends AbstractRegressionTest {
if ((complianceLevels & AbstractCompilerTest.F_14) != 0) {
testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTestForRecord.class, ClassFileConstants.JDK14));
}
+ if ((complianceLevels & AbstractCompilerTest.F_15) != 0) {
+ testSuite.addTest(buildUniqueComplianceTestSuite(JavadocTest_15.class, ClassFileConstants.JDK15));
+ }
return testSuite;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForRecord.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForRecord.java
index 4d56617859..8d8597d491 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForRecord.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForRecord.java
@@ -56,7 +56,7 @@ public class JavadocTestForRecord extends JavadocTest {
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_14);
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -94,9 +94,9 @@ public class JavadocTestForRecord extends JavadocTest {
options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsMethodTypeParameters, CompilerOptions.ENABLED);
options.put(CompilerOptions.OPTION_Release, CompilerOptions.ENABLED);
- options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14); // FIXME
- options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
- options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15); // FIXME
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
options.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
return options;
@@ -109,7 +109,7 @@ public class JavadocTestForRecord extends JavadocTest {
@Override
protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
- runNegativeTest(testFiles, expectedCompilerLog, JavacTestOptions.forReleaseWithPreview("14"));
+ runNegativeTest(testFiles, expectedCompilerLog, JavacTestOptions.forReleaseWithPreview("15"));
}
@Override
@@ -125,7 +125,7 @@ public class JavadocTestForRecord extends JavadocTest {
runner.expectedOutputString = expectedOutput;
runner.vmArguments = new String[] { "--enable-preview" };
runner.customOptions = customOptions;
- runner.javacTestOptions = JavacTestOptions.forReleaseWithPreview("14");
+ runner.javacTestOptions = JavacTestOptions.forReleaseWithPreview("15");
runner.runConformTest();
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_15.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_15.java
new file mode 100644
index 0000000000..b3d9f6d4c0
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_15.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.io.File;
+import java.util.Map;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class JavadocTest_15 extends JavadocTest {
+
+ String docCommentSupport = CompilerOptions.ENABLED;
+ String reportInvalidJavadoc = CompilerOptions.ERROR;
+ String reportMissingJavadocDescription = CompilerOptions.RETURN_TAG;
+ String reportInvalidJavadocVisibility = CompilerOptions.PRIVATE;
+ String reportMissingJavadocTags = CompilerOptions.ERROR;
+ String reportMissingJavadocComments = null;
+ String reportMissingJavadocCommentsVisibility = null;
+ String reportDeprecation = CompilerOptions.ERROR;
+ String reportJavadocDeprecation = null;
+ String processAnnotations = null;
+
+public JavadocTest_15(String name) {
+ super(name);
+}
+
+public static Class javadocTestClass() {
+ return JavadocTest_15.class;
+}
+
+// Use this static initializer to specify subset for tests
+// All specified tests which does not belong to the class are skipped...
+static {
+
+}
+
+public static Test suite() {
+ return buildMinimalComplianceTestSuite(javadocTestClass(), F_15);
+}
+
+@Override
+protected Map getCompilerOptions() {
+ Map options = super.getCompilerOptions();
+ options.put(CompilerOptions.OPTION_DocCommentSupport, this.docCommentSupport);
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, this.reportInvalidJavadoc);
+ if (!CompilerOptions.IGNORE.equals(this.reportInvalidJavadoc)) {
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility, this.reportInvalidJavadocVisibility);
+ }
+ if (this.reportJavadocDeprecation != null) {
+ options.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsDeprecatedRef, this.reportJavadocDeprecation);
+ }
+ if (this.reportMissingJavadocComments != null) {
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, this.reportMissingJavadocComments);
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocCommentsOverriding, CompilerOptions.ENABLED);
+ if (this.reportMissingJavadocCommentsVisibility != null) {
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocCommentsVisibility, this.reportMissingJavadocCommentsVisibility);
+ }
+ } else {
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, this.reportInvalidJavadoc);
+ }
+ if (this.reportMissingJavadocTags != null) {
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTags, this.reportMissingJavadocTags);
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsOverriding, CompilerOptions.ENABLED);
+ } else {
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTags, this.reportInvalidJavadoc);
+ }
+ if (this.reportMissingJavadocDescription != null) {
+ options.put(CompilerOptions.OPTION_ReportMissingJavadocTagDescription, this.reportMissingJavadocDescription);
+ }
+ if (this.processAnnotations != null) {
+ options.put(CompilerOptions.OPTION_Process_Annotations, this.processAnnotations);
+ }
+ options.put(CompilerOptions.OPTION_ReportFieldHiding, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportSyntheticAccessEmulation, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportDeprecation, this.reportDeprecation);
+ options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
+ return options;
+}
+/* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+@Override
+protected void setUp() throws Exception {
+ super.setUp();
+ this.docCommentSupport = CompilerOptions.ENABLED;
+ this.reportInvalidJavadoc = CompilerOptions.ERROR;
+ this.reportInvalidJavadocVisibility = CompilerOptions.PRIVATE;
+ this.reportMissingJavadocTags = CompilerOptions.IGNORE;
+ this.reportMissingJavadocComments = CompilerOptions.IGNORE;
+ this.reportMissingJavadocCommentsVisibility = CompilerOptions.PUBLIC;
+ this.reportDeprecation = CompilerOptions.ERROR;
+}
+
+public void test001() {
+ File outputDirectory = new File(OUTPUT_DIR);
+ Util.flushDirectoryContent(outputDirectory);
+
+ String moduleInfo = "" +
+ "/**\n" +
+ " */\n" +
+ "module mod.one { \n" +
+ " exports p;\n" +
+ "}";
+ String I1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * interface I1\n" +
+ " * @see mod.one/\n" +
+ " */\n" +
+ "interface I1 {\n" +
+ " /**\n" +
+ " * Method foo\n" +
+ " * @return int\n" +
+ " */\n" +
+ " public int foo();\n" +
+ "}";
+
+ String P1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * class P1\n" +
+ " * @see mod.one/p.I1\n" +
+ " */\n" +
+ "public class P1 implements I1 {\n" +
+ " @Override\n" +
+ " public int foo() { return 0; }\n" +
+ "}";
+
+ this.runConformTest(new String[] {"p/I1.java", I1 ,"p/P1.java" , P1 } ,
+ new String[] {"module-info.java", moduleInfo }, "" );
+}
+
+public void test002() {
+ File outputDirectory = new File(OUTPUT_DIR);
+ Util.flushDirectoryContent(outputDirectory);
+
+ String moduleInfo = "" +
+ "/**\n" +
+ " */\n" +
+ "module mod.one { \n" +
+ " exports p;\n" +
+ "}";
+ String I1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * interface I1\n" +
+ " * {@link mod.one/}\n" +
+ " */\n" +
+ "interface I1 {\n" +
+ " /**\n" +
+ " * Method foo\n" +
+ " * @return int\n" +
+ " */\n" +
+ " public int foo();\n" +
+ "}";
+
+ String P1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * class P1\n" +
+ " * {@link mod.one/p.I1}\n" +
+ " */\n" +
+ "public class P1 implements I1 {\n" +
+ " @Override\n" +
+ " public int foo() { return 0; }\n" +
+ "}";
+
+ this.runConformTest(new String[] {"p/I1.java", I1 ,"p/P1.java" , P1 } ,
+ new String[] {"module-info.java", moduleInfo }, "" );
+}
+
+public void test003() {
+ File outputDirectory = new File(OUTPUT_DIR);
+ Util.flushDirectoryContent(outputDirectory);
+
+ String moduleInfo = "" +
+ "/**\n" +
+ " */\n" +
+ "module mod.one { \n" +
+ " exports p;\n" +
+ "}";
+ String I1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * interface I1\n" +
+ " * {@linkplain mod.one/}\n" +
+ " */\n" +
+ "interface I1 {\n" +
+ " /**\n" +
+ " * Method foo\n" +
+ " * @return int\n" +
+ " */\n" +
+ " public int foo();\n" +
+ "}";
+
+ String P1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * class P1\n" +
+ " * {@linkplain mod.one/p.I1}\n" +
+ " */\n" +
+ "public class P1 implements I1 {\n" +
+ " @Override\n" +
+ " public int foo() { return 0; }\n" +
+ "}";
+
+ this.runConformTest(new String[] {"p/I1.java", I1 ,"p/P1.java" , P1 } ,
+ new String[] {"module-info.java", moduleInfo }, "" );
+}
+
+public void test004() {
+ File outputDirectory = new File(OUTPUT_DIR);
+ Util.flushDirectoryContent(outputDirectory);
+
+ String moduleInfo = "" +
+ "/**\n" +
+ " */\n" +
+ "module mod.one { \n" +
+ " exports p;\n" +
+ "}";
+ String I1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * interface I1\n" +
+ " * {@linkplain mod.one/}\n" +
+ " */\n" +
+ "interface I1 {\n" +
+ " /**\n" +
+ " * Method foo\n" +
+ " * @return int\n" +
+ " */\n" +
+ " public int foo();\n" +
+ "}";
+
+ String P1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * class P1\n" +
+ " * {@linkplain mod.one/p.P1#foo()}\n" +
+ " */\n" +
+ "public class P1 implements I1 {\n" +
+ " @Override\n" +
+ " public int foo() { return 0; }\n" +
+ "}";
+
+ this.runConformTest(new String[] {"p/I1.java", I1 ,"p/P1.java" , P1 } ,
+ new String[] {"module-info.java", moduleInfo }, "" );
+}
+
+public void test005() {
+ File outputDirectory = new File(OUTPUT_DIR);
+ Util.flushDirectoryContent(outputDirectory);
+
+ String moduleInfo = "" +
+ "/**\n" +
+ " */\n" +
+ "module mod.one { \n" +
+ " exports p;\n" +
+ "}";
+ String I1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * interface I1\n" +
+ " * {@linkplain mod.one/}\n" +
+ " */\n" +
+ "interface I1 {\n" +
+ " /**\n" +
+ " * Method foo\n" +
+ " * @return int\n" +
+ " */\n" +
+ " public int foo();\n" +
+ "}";
+
+ String P1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * class P1\n" +
+ " * {@linkplain mod.one/p.P1#abc}\n" +
+ " */\n" +
+ "public class P1 implements I1 {\n" +
+ " public int abc;\n" +
+ " @Override\n" +
+ " public int foo() { return 0; }\n" +
+ "}";
+
+ this.runConformTest(new String[] {"p/I1.java", I1 ,"p/P1.java" , P1 } ,
+ new String[] {"module-info.java", moduleInfo }, "" );
+}
+
+public void test006() {
+ File outputDirectory = new File(OUTPUT_DIR);
+ Util.flushDirectoryContent(outputDirectory);
+
+ String moduleInfo = "" +
+ "/**\n" +
+ " */\n" +
+ "module mod.one { \n" +
+ " exports p;\n" +
+ "}";
+ String I1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * interface I1\n" +
+ " * {@linkplain mod.one/}\n" +
+ " */\n" +
+ "interface I1 {\n" +
+ " /**\n" +
+ " * Method foo\n" +
+ " * @return int\n" +
+ " */\n" +
+ " public int foo();\n" +
+ "}";
+
+ String P1 = "" +
+ "package p;\n" +
+ "/**\n" +
+ " * class P1\n" +
+ " * {@linkplain mod.one/p.P1#abd}\n" +
+ " */\n" +
+ "public class P1 implements I1 {\n" +
+ " public int abc;\n" +
+ " @Override\n" +
+ " public int foo() { return 0; }\n" +
+ "}";
+ String errorMsg = "" +
+ "----------\n" +
+ "1. ERROR in p\\P1.java (at line 4)\n" +
+ " * {@linkplain mod.one/p.P1#abd}\n" +
+ " ^^^\n" +
+ "Javadoc: abd cannot be resolved or is not a field\n" +
+ "----------\n";
+
+ this.runNegativeTest(new String[] {"p/I1.java", I1 ,"p/P1.java" , P1 } ,
+ new String[] {"module-info.java", moduleInfo }, errorMsg,
+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+}
+
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
index 1f430b4616..7a94b5ec82 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2018 IBM Corporation and others.
+ * Copyright (c) 2011, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -39,7 +39,7 @@ import junit.framework.Test;
public class LambdaExpressionsTest extends AbstractRegressionTest {
static {
-// TESTS_NAMES = new String[] { "testBug540520"};
+// TESTS_NAMES = new String[] { "test056"};
// TESTS_NUMBERS = new int[] { 50 };
// TESTS_RANGE = new int[] { 11, -1 };
}
@@ -1605,6 +1605,7 @@ public void test055() {
"");
}
public void test056() {
+ String expected = isJRE15Plus ? "Cannot invoke \"Object.getClass()\" because \"x\" is null" : "null";
this.runConformTest(
new String[] {
"X.java",
@@ -1626,7 +1627,7 @@ public void test056() {
" }\n" +
"}\n"
},
- "null");
+ expected);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=410114, [1.8] CCE when trying to parse method reference expression with inappropriate type arguments
public void test057() {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java
new file mode 100644
index 0000000000..848fb0ecfe
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest_15.java
@@ -0,0 +1,930 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.jdt.core.ToolFactory;
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+import junit.framework.Test;
+
+public class LocalStaticsTest_15 extends AbstractRegressionTest {
+
+ static {
+// TESTS_NUMBERS = new int [] { 40 };
+// TESTS_RANGE = new int[] { 1, -1 };
+// TESTS_NAMES = new String[] { "testBug566715_003"};
+ }
+
+ public static Class<?> testClass() {
+ return LocalStaticsTest_15.class;
+ }
+ public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
+ }
+ public LocalStaticsTest_15(String testName){
+ super(testName);
+ }
+
+ // Enables the tests to run individually
+ protected Map<String, String> getCompilerOptions() {
+ Map<String, String> defaultOptions = super.getCompilerOptions();
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15); // FIXME
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
+ defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
+ defaultOptions.put(CompilerOptions.OPTION_Store_Annotations, CompilerOptions.ENABLED);
+ return defaultOptions;
+ }
+
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput) {
+ runConformTest(testFiles, expectedOutput, getCompilerOptions());
+ }
+
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput, Map<String, String> customOptions) {
+ Runner runner = new Runner();
+ runner.testFiles = testFiles;
+ runner.expectedOutputString = expectedOutput;
+ runner.vmArguments = new String[] {"--enable-preview"};
+ runner.customOptions = customOptions;
+ runner.javacTestOptions = JavacTestOptions.forReleaseWithPreview("15");
+ runner.runConformTest();
+ }
+ @Override
+ protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
+ runNegativeTest(testFiles, expectedCompilerLog, JavacTestOptions.forReleaseWithPreview("15"));
+ }
+ protected void runWarningTest(String[] testFiles, String expectedCompilerLog) {
+ runWarningTest(testFiles, expectedCompilerLog, null);
+ }
+ protected void runWarningTest(String[] testFiles, String expectedCompilerLog, Map<String, String> customOptions) {
+ runWarningTest(testFiles, expectedCompilerLog, customOptions, null);
+ }
+ protected void runWarningTest(String[] testFiles, String expectedCompilerLog,
+ Map<String, String> customOptions, String javacAdditionalTestOptions) {
+
+ Runner runner = new Runner();
+ runner.testFiles = testFiles;
+ runner.expectedCompilerLog = expectedCompilerLog;
+ runner.customOptions = customOptions;
+ runner.vmArguments = new String[] {"--enable-preview"};
+ runner.javacTestOptions = javacAdditionalTestOptions == null ? JavacTestOptions.forReleaseWithPreview("15") :
+ JavacTestOptions.forReleaseWithPreview("15", javacAdditionalTestOptions);
+ runner.runWarningTest();
+ }
+
+ @SuppressWarnings("unused")
+ private static void verifyClassFile(String expectedOutput, String classFileName, int mode)
+ throws IOException, ClassFormatException {
+ File f = new File(OUTPUT_DIR + File.separator + classFileName);
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String result = disassembler.disassemble(classFileBytes, "\n", mode);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ System.out.println("...");
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ }
+
+ public void testBug566284_001() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " static void foo() {\n"+
+ " interface F {\n"+
+ " static int create(int lo) {\n"+
+ " I myI = s -> lo;\n"+
+ " return myI.bar(0);\n"+
+ " }\n"+
+ " }\n"+
+ " System.out.println(F.create(0));\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "\n"+
+ "interface I {\n"+
+ " int bar(int l);\n"+
+ "}"
+ },
+ "0");
+ }
+
+
+ public void testBug566284_002() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " static void foo() {\n"+
+ " record R() {\n"+
+ " static int create(int lo) {\n"+
+ " I myI = s -> lo;\n"+
+ " return myI.bar(0);\n"+
+ " }\n"+
+ " }\n"+
+ " System.out.println(R.create(0));\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "\n"+
+ "interface I {\n"+
+ " int bar(int l);\n"+
+ "}"
+ },
+ "0");
+ }
+ public void testBug566284_003() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " static int si;\n"+
+ " int nsi;\n"+
+ "\n"+
+ " void m() {\n"+
+ " int li;\n"+
+ "\n"+
+ " interface F {\n"+
+ " static int fi = 0;\n"+
+ "\n"+
+ " default void foo(int i) {\n"+
+ " System.out.println(li); // error, local variable of method of outer enclosing class\n"+
+ " System.out.println(nsi); // error, non-static member\n"+
+ " System.out.println(fi); // ok, static member of current class\n"+
+ " System.out.println(si); // ok, static member of enclosing class\n"+
+ " System.out.println(i); // ok, local variable of current method\n"+
+ " }\n"+
+ "\n"+
+ " static void bar(int lo) {\n"+
+ " int k = lo; // ok\n"+
+ " int j = fi; // ok\n"+
+ " I myI = s -> lo; // ok, local var of method\n"+
+ " }\n"+
+ "\n"+
+ " static void bar2(int lo) {\n"+
+ " I myI = s -> li; // error - local var of outer class\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "\n"+
+ "interface I {\n"+
+ " int bar(int l);\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 12)\n" +
+ " System.out.println(li); // error, local variable of method of outer enclosing class\n" +
+ " ^^\n" +
+ "Cannot make a static reference to the non-static variable li\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 13)\n" +
+ " System.out.println(nsi); // error, non-static member\n" +
+ " ^^^\n" +
+ "Cannot make a static reference to the non-static field nsi\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 26)\n" +
+ " I myI = s -> li; // error - local var of outer class\n" +
+ " ^^\n" +
+ "Cannot make a static reference to the non-static variable li\n" +
+ "----------\n"
+ );
+ }
+
+ public void testBug566518_001() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " static void foo() {\n"+
+ " int f = switch (5) {\n"+
+ " case 5: {\n"+
+ " interface I{\n"+
+ " \n"+
+ " }\n"+
+ " class C implements I{\n"+
+ " public int j = 5;\n"+
+ " }\n"+
+ " \n"+
+ " yield new C().j;\n"+
+ " }\n"+
+ " default:\n"+
+ " throw new IllegalArgumentException(\"Unexpected value: \" );\n"+
+ " };\n"+
+ " System.out.println(f);\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}"
+ },
+ "5");
+ }
+
+ public void testBug566518_002() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " static void foo() {\n"+
+ " class F {\n"+
+ " int create(int lo) {\n"+
+ " I myI = s -> lo;\n"+
+ " return myI.bar(0);\n"+
+ " }\n"+
+ " }\n"+
+ " System.out.println(new F().create(0));\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "\n"+
+ "interface I {\n"+
+ " int bar(int l);\n"+
+ "}"
+ },
+ "0");
+ }
+
+ public void testBug566518_003() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public interface X {\n"+
+ " static void foo() {\n"+
+ " class F {\n"+
+ " int create(int lo) {\n"+
+ " I myI = s -> lo;\n"+
+ " return myI.bar(0);\n"+
+ " }\n"+
+ " }\n"+
+ " System.out.println(new F().create(0));\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "\n"+
+ "interface I {\n"+
+ " int bar(int l);\n"+
+ "}"
+ },
+ "0");
+ }
+
+ public void testBug566518_004() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public interface X {\n"+
+ " static void foo() {\n"+
+ " interface F {\n"+
+ " static int create(int lo) {\n"+
+ " I myI = s -> lo;\n"+
+ " return myI.bar(0);\n"+
+ " }\n"+
+ " }\n"+
+ " System.out.println(F.create(0));\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "\n"+
+ "interface I {\n"+
+ " int bar(int l);\n"+
+ "}"
+ },
+ "0");
+ }
+
+ public void testBug566518_005() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " static void foo() {\n"+
+ " int f = switch (5) {\n"+
+ " case 5: {\n"+
+ " interface I{\n"+
+ " \n"+
+ " }\n"+
+ " class C implements I{\n"+
+ " public int j = 5;\n"+
+ " }\n"+
+ " \n"+
+ " yield new C().j;\n"+
+ " }\n"+
+ " default:\n"+
+ " throw new IllegalArgumentException(\"Unexpected value: \" );\n"+
+ " };\n"+
+ " System.out.println(f);\n"+
+ " class C1 implements I{\n"+
+ " public int j = 5;\n"+
+ " }\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X.foo();\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n"+
+ "1. ERROR in X.java (at line 18)\n"+
+ " class C1 implements I{\n"+
+ " ^\n" +
+ "I cannot be resolved to a type\n"+
+ "----------\n"
+ );
+ }
+
+ public void testBug566518_006() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public enum X {\n"+
+ " A, B, C;\n"+
+ " public void foo() {\n"+
+ " int f = switch (5) {\n"+
+ " case 5: {\n"+
+ " interface I{\n"+
+ " \n"+
+ " }\n"+
+ " class C implements I{\n"+
+ " public int j = 5;\n"+
+ " }\n"+
+ " \n"+
+ " yield new C().j;\n"+
+ " }\n"+
+ " default:\n"+
+ " throw new IllegalArgumentException(\"Unexpected value: \" );\n"+
+ " };\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " X x = X.A;\n"+
+ " System.out.println();\n"+
+ " }\n"+
+ "}"
+ },
+ "");
+ }
+ // 6.5.5.1
+ public void testBug566715_001() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " static void foo() {\n"+
+ " interface I {\n"+
+ " X<T> supply();\n"+
+ " }\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n"+
+ "1. WARNING in X.java (at line 3)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " X<T> supply();\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static type T\n" +
+ "----------\n"
+ );
+ }
+ // 6.5.5.1
+ public void testBug566715_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " interface I {\n"+
+ " X<T> supply();\n"+
+ " }\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n"+
+ "1. WARNING in X.java (at line 3)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " X<T> supply();\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static type T\n" +
+ "----------\n"
+ );
+ }
+ // 6.5.5.1
+ public void testBug566715_003() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " record R(X<T> x) {}\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " record R(X<T> x) {}\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static type T\n" +
+ "----------\n"
+ );
+ }
+ // 9.1.1/14.3
+ public void testBug566720_001() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " public interface I {}\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " public interface I {}\n" +
+ " ^\n" +
+ "Illegal modifier for the local interface I; abstract and strictfp are the only modifiers allowed explicitly \n" +
+ "----------\n"
+ );
+ }
+ // 9.1.1/14.3
+ public void testBug566720_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " private interface I {}\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " private interface I {}\n" +
+ " ^\n" +
+ "Illegal modifier for the local interface I; abstract and strictfp are the only modifiers allowed explicitly \n" +
+ "----------\n"
+ );
+ }
+ // 9.1.1
+ public void testBug566720_003() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " protected interface I {}\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " protected interface I {}\n" +
+ " ^\n" +
+ "Illegal modifier for the local interface I; abstract and strictfp are the only modifiers allowed explicitly \n" +
+ "----------\n"
+ );
+ }
+ // 9.1.1
+ public void testBug566720_004() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " final interface I {}\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " final interface I {}\n" +
+ " ^\n" +
+ "Illegal modifier for the local interface I; abstract and strictfp are the only modifiers allowed explicitly \n" +
+ "----------\n"
+ );
+ }
+ // 9.1.1
+ public void testBug566720_005() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<T> {\n"+
+ " void foo() {\n"+
+ " static interface I {}\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " static interface I {}\n" +
+ " ^\n" +
+ "Illegal modifier for the local interface I; abstract and strictfp are the only modifiers allowed explicitly \n" +
+ "----------\n"
+ );
+ }
+ public void testBug566748_001() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n"+
+ " int count;\n"+
+ " void doNothing() {}\n"+
+ " void foo1(String s) {\n"+
+ " int i;\n"+
+ " interface I {\n"+
+ " default X<T> bar() {\n"+
+ " if (count > 0 || i > 0 || s == null)\n"+
+ " return null;\n"+
+ " doNothing();\n"+
+ " return null;\n"+
+ " }\n"+
+ " } \n"+
+ " }\n"+
+ " void foo2(String s) {\n"+
+ " try {\n"+
+ " throw new Exception();\n"+
+ " } catch (Exception e) {\n"+
+ " interface I {\n"+
+ " default int bar() {\n"+
+ " return e != null ? 0 : 1;\n"+
+ " }\n"+
+ " } \n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 6)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 7)\n" +
+ " default X<T> bar() {\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static type T\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 8)\n" +
+ " if (count > 0 || i > 0 || s == null)\n" +
+ " ^^^^^\n" +
+ "Cannot make a static reference to the non-static field count\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 8)\n" +
+ " if (count > 0 || i > 0 || s == null)\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static variable i\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 8)\n" +
+ " if (count > 0 || i > 0 || s == null)\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static variable s\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 10)\n" +
+ " doNothing();\n" +
+ " ^^^^^^^^^\n" +
+ "Cannot make a static reference to the non-static method doNothing() from the type X<T>\n" +
+ "----------\n" +
+ "7. WARNING in X.java (at line 19)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "8. ERROR in X.java (at line 21)\n" +
+ " return e != null ? 0 : 1;\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static variable e\n" +
+ "----------\n"
+ );
+ }
+ public void testBug566748_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X<T> {\n"+
+ " int count = 0;\n"+
+ "\n"+
+ " default void doNothing() {}\n"+
+ "\n"+
+ " default void foo1(String s) {\n"+
+ " int i;\n"+
+ " interface I {\n"+
+ " default X<T> bar() {\n"+
+ " if (count > 0 || i > 0 || s == null)\n"+
+ " return null;\n"+
+ " doNothing();\n"+
+ " return null;\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "\n"+
+ " default void foo2(String s) {\n"+
+ " try {\n"+
+ " throw new Exception();\n"+
+ " } catch (Exception e) {\n"+
+ " interface I { \n"+
+ " default int bar() {\n"+
+ " return e != null ? 0 : 1;\n"+
+ " } \n"+
+ " } \n"+
+ " \n"+
+ " } \n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 8)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " default X<T> bar() {\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static type T\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 10)\n" +
+ " if (count > 0 || i > 0 || s == null)\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static variable i\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 10)\n" +
+ " if (count > 0 || i > 0 || s == null)\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static variable s\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 12)\n" +
+ " doNothing();\n" +
+ " ^^^^^^^^^\n" +
+ "Cannot make a static reference to the non-static method doNothing() from the type X<T>\n" +
+ "----------\n" +
+ "6. WARNING in X.java (at line 22)\n" +
+ " interface I { \n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "7. ERROR in X.java (at line 24)\n" +
+ " return e != null ? 0 : 1;\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static variable e\n" +
+ "----------\n"
+ );
+ }
+ // 9.6
+ public void testBug564557AnnotInterface_001() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() {\n"+
+ " class I {\n"+
+ " @interface Annot {\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " @interface Annot {\n" +
+ " ^^^^^\n" +
+ "The member annotation Annot can only be defined inside a top-level class or interface or in a static context\n" +
+ "----------\n"
+ );
+ }
+ // 9.6
+ public void testBug564557AnnotInterface_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() {\n"+
+ " interface I {\n"+
+ " @interface Annot {\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " @interface Annot {\n" +
+ " ^^^^^\n" +
+ "The member annotation Annot can only be defined inside a top-level class or interface or in a static context\n" +
+ "----------\n"
+ );
+ }
+ // 9.4 && 15.12.3
+ public void testBug564557MethodInvocation_003() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() {\n"+
+ " Zork();\n"+
+ " interface I {\n"+
+ " default void bar() {}\n"+
+ " default void b1() {\n"+
+ " class J {\n"+
+ " void jb2() {\n"+
+ " bar();\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n"
+ );
+ }
+ // 9.4 && 15.12.3
+ public void testBug564557MethodInvocation_004() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() {\n"+
+ " interface I {\n"+
+ " default void bar() {}\n"+
+ " default void b1() {\n"+
+ " interface J {\n"+
+ " default void jb2() {\n"+
+ " bar();\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 5)\n" +
+ " default void b1() {\n" +
+ " ^^^^\n" +
+ "The method b1() from the type I is never used locally\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " interface J {\n" +
+ " ^\n" +
+ "The type J is never used locally\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 8)\n" +
+ " bar();\n" +
+ " ^^^\n" +
+ "Cannot make a static reference to the non-static method bar() from the type I\n" +
+ "----------\n"
+ );
+ }
+ // 13.1
+ public void testBug564557BinaryForm_005() throws Exception {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(\"\");\n"+
+ " }\n"+
+ " void foo() {\n"+
+ " interface I {\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "");
+ String expectedOutput = "abstract static interface X$1I {\n";
+ LocalStaticsTest_15.verifyClassFile(expectedOutput, "X$1I.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // 14.3 for enum
+ public void testBug564557BinaryForm_006() throws Exception {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(\"\");\n"+
+ " }\n"+
+ " void foo() {\n"+
+ " enum I {\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "");
+ String expectedOutput = "static final enum X$1I {\n";
+ LocalStaticsTest_15.verifyClassFile(expectedOutput, "X$1I.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // 15.8.3
+ public void testBug564557thisInStatic_007() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() {\n"+
+ " interface I {\n"+
+ " int count = 0;\n"+
+ " static void bar() {\n"+
+ " int i = this.count;\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 4)\n" +
+ " int count = 0;\n" +
+ " ^^^^^\n" +
+ "The value of the field I.count is not used\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " int i = this.count;\n" +
+ " ^^^^\n" +
+ "Cannot use this in a static context\n" +
+ "----------\n"
+ );
+ }
+ // 15.8.3
+ public void testBug564557thisInStatic_008() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " int count = 0;\n"+
+ " void foo() {\n"+
+ " interface I {\n"+
+ " static void bar() {\n"+
+ " int i = X.this.count;\n"+
+ " }\n"+
+ " }\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 4)\n" +
+ " interface I {\n" +
+ " ^\n" +
+ "The type I is never used locally\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " int i = X.this.count;\n" +
+ " ^^^^^^\n" +
+ "No enclosing instance of the type X is accessible in scope\n" +
+ "----------\n"
+ );
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching14Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching15Test.java
index 7473aaf0e0..e39f23c842 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching14Test.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching15Test.java
@@ -18,30 +18,30 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import junit.framework.Test;
-public class PatternMatching14Test extends AbstractRegressionTest {
+public class PatternMatching15Test extends AbstractRegressionTest {
- private static final JavacTestOptions JAVAC_OPTIONS = new JavacTestOptions("-source 14 --enable-preview -Xlint:-preview");
+ private static final JavacTestOptions JAVAC_OPTIONS = new JavacTestOptions("-source 15 --enable-preview -Xlint:-preview");
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testBug562392" };
+// TESTS_NAMES = new String[] { "test025b" };
}
public static Class<?> testClass() {
- return PatternMatching14Test.class;
+ return PatternMatching15Test.class;
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_14);
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
}
- public PatternMatching14Test(String testName){
+ public PatternMatching15Test(String testName){
super(testName);
}
// Enables the tests to run individually
protected Map<String, String> getCompilerOptions(boolean preview) {
Map<String, String> defaultOptions = super.getCompilerOptions();
- defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
defaultOptions.put(CompilerOptions.OPTION_EnablePreviews,
preview ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.WARNING);
@@ -50,6 +50,8 @@ public class PatternMatching14Test extends AbstractRegressionTest {
@Override
protected void runConformTest(String[] testFiles, String expectedOutput, Map<String, String> customOptions) {
+ if(!isJRE15Plus)
+ return;
runConformTest(testFiles, expectedOutput, customOptions, new String[] {"--enable-preview"}, JAVAC_OPTIONS);
}
protected void runNegativeTest(
@@ -67,6 +69,62 @@ public class PatternMatching14Test extends AbstractRegressionTest {
runner.expectedJavacOutputString = javacLog;
runner.runNegativeTest();
}
+ public void test000a() {
+ Map<String, String> options = getCompilerOptions(false);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
+ runNegativeTest(
+ new String[] {
+ "X1.java",
+ "public class X1 {\n" +
+ " public void foo(Object obj) {\n" +
+ " if (obj instanceof String s) {\n" +
+ " }\n " +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X1.java (at line 3)\n" +
+ " if (obj instanceof String s) {\n" +
+ " ^^^^^^^^\n" +
+ "The preview feature Pattern Matching in instanceof Expressions is only available with source level 15 and above\n" +
+ "----------\n",
+ null,
+ true,
+ options);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
+ }
+ public void test000b() {
+ Map<String, String> options = getCompilerOptions(true);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
+ runNegativeTest(
+ new String[] {
+ "X1.java",
+ "public class X1 {\n" +
+ " public void foo(Object obj) {\n" +
+ " if (obj instanceof String s) {\n" +
+ " }\n " +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X1.java (at line 0)\n" +
+ " public class X1 {\n" +
+ " ^\n" +
+ "Preview features enabled at an invalid source release level 14, preview can be enabled only at source level 15\n" +
+ "----------\n",
+ null,
+ true,
+ options);
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
+ }
public void test001() {
Map<String, String> options = getCompilerOptions(false);
runNegativeTest(
@@ -83,7 +141,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X1.java (at line 3)\n" +
" if (obj instanceof String s) {\n" +
" ^^^^^^^^\n" +
- "Instanceof Pattern is a preview feature and disabled by default. Use --enable-preview to enable\n" +
+ "Pattern Matching in instanceof Expressions is a preview feature and disabled by default. Use --enable-preview to enable\n" +
"----------\n",
/* omit one arg to directly call super method without JAVA_OPTIONS */
null,
@@ -260,12 +318,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X6a.java (at line 8)\n" +
" System.out.print(i);\n" +
" ^\n" +
- "The pattern variable i is not in scope in this location\n" +
+ "i cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X6a.java (at line 11)\n" +
" System.out.print(i);\n" +
" ^\n" +
- "The pattern variable i is not in scope in this location\n" +
+ "i cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -298,12 +356,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X6b.java (at line 8)\n" +
" System.out.print(i);\n" +
" ^\n" +
- "The pattern variable i is not in scope in this location\n" +
+ "i cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X6b.java (at line 11)\n" +
" System.out.print(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -333,7 +391,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X6c.java (at line 7)\n" +
" System.out.print(i);\n" +
" ^\n" +
- "The pattern variable i is not in scope in this location\n" +
+ "i cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -363,7 +421,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X6d.java (at line 7)\n" +
" System.out.print(i);\n" +
" ^\n" +
- "The pattern variable i is not in scope in this location\n" +
+ "i cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -393,7 +451,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X7.java (at line 7)\n" +
" System.out.print(i);\n" +
" ^\n" +
- "The pattern variable i is not in scope in this location\n" +
+ "i cannot be resolved to a variable\n" +
"----------\n",
"X7.java:4: warning: [preview] pattern matching in instanceof is a preview feature and may be removed in a future release.\n" +
" if (obj instanceof Integer i) {\n" +
@@ -514,7 +572,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X11.java (at line 7)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -549,7 +607,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X12.java (at line 11)\n" +
" s = null;\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -580,15 +638,10 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"}\n",
},
"----------\n" +
- "1. WARNING in X13.java (at line 7)\n" +
- " System.out.println(\"s:\" + s);\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Dead code\n" +
- "----------\n" +
- "2. ERROR in X13.java (at line 9)\n" +
+ "1. ERROR in X13.java (at line 9)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -618,7 +671,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X14.java (at line 5)\n" +
" System.out.print(\"then:\" + s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -648,7 +701,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X14a.java (at line 5)\n" +
" System.out.print(\"then:\" + s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -678,7 +731,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X14b.java (at line 7)\n" +
" System.out.print(\"else:\" + s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -708,7 +761,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X14c.java (at line 7)\n" +
" System.out.print(\"else:\" + s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -838,7 +891,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X15b.java (at line 9)\n" +
" System.out.print(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -884,7 +937,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X17.java (at line 5)\n" +
" System.out.print(s[0]);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1006,12 +1059,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X21.java (at line 5)\n" +
" System.out.print(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X21.java (at line 6)\n" +
" System.out.print(s2);\n" +
" ^^\n" +
- "The pattern variable s2 is not in scope in this location\n" +
+ "s2 cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1063,17 +1116,17 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X22a.java (at line 8)\n" +
" o = s.substring(0, s.length() - 1);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n" +
"2. ERROR in X22a.java (at line 8)\n" +
" o = s.substring(0, s.length() - 1);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n" +
"3. ERROR in X22a.java (at line 9)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
null,
true,
@@ -1101,7 +1154,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X22b.java (at line 10)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
null,
true,
@@ -1152,12 +1205,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X23.java (at line 7)\n" +
" while (!(o instanceof String s) && s.length() > 0) {\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n" +
"2. ERROR in X23.java (at line 8)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1186,12 +1239,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X23a.java (at line 8)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X23a.java (at line 10)\n" +
" } while (!(o instanceof String s) && s.length() > 0);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n",
"",
null,
@@ -1222,12 +1275,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X23b.java (at line 7)\n" +
" while (!(o instanceof String s) && s.length() > 0) {\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n" +
"2. ERROR in X23b.java (at line 8)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1257,12 +1310,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X23c.java (at line 8)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X23c.java (at line 10)\n" +
" }while (!(o instanceof String s) && s.length() > 0);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n",
"",
null,
@@ -1336,7 +1389,143 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X25.java (at line 8)\n" +
" System.out.print(\"s:\" + s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
+ "----------\n",
+ "",
+ null,
+ true,
+ options);
+ }
+ public void test025a() {
+ Map<String, String> options = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X25.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X25 {\n" +
+ " public static void main(String[] o) {\n" +
+ " foo(\"one\");\n" +
+ " }\n" +
+ " public static void foo(Object o) {\n" +
+ " if ( (o instanceof String a) || (! (o instanceof String a)) ) {\n" +
+ " System.out.print(\"a:\" + a);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X25.java (at line 8)\n" +
+ " System.out.print(\"a:\" + a);\n" +
+ " ^\n" +
+ "a cannot be resolved to a variable\n" +
+ "----------\n",
+ "",
+ null,
+ true,
+ options);
+ }
+ public void test025b() {
+ Map<String, String> options = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X25.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X25 {\n" +
+ " public static void main(String[] o) {\n" +
+ " foo(\"one\");\n" +
+ " }\n" +
+ " public static void foo(Object o) {\n" +
+ " if ( (o instanceof String a) || (! (o instanceof String a)) ) {\n" +
+ " System.out.println(\"none\");\n" +
+ " } else {\n" +
+ " System.out.print(\"a:\" + a);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n",
+ },
+ "none",
+ options);
+ }
+ public void test025c() {
+ Map<String, String> options = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X25.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X25 {\n" +
+ " public static void main(String[] o) {\n" +
+ " foo(\"one\", new Integer(0));\n" +
+ " }\n" +
+ " public static void foo(Object o, Object p) {\n" +
+ " if ( (o instanceof String a) || (! (p instanceof String a)) ) {\n" +
+ " System.out.println(\"none\");\n" +
+ " } else {\n" +
+ " System.out.print(\"a:\" + a);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n",
+ },
+ "none",
+ options);
+ }
+ /*
+ * It's not allowed to have two pattern variables with same name in the
+ * same scope
+ */
+ public void test026() {
+ Map<String, String> options = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X26.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X26 {\n" +
+ " public static void main(String[] o) {\n" +
+ " foo(\"one\", \"two\");\n" +
+ " }\n" +
+ " public static void foo(Object o, Object p) {\n" +
+ " if ((o instanceof String s) && (p instanceof String s)) {\n" +
+ " System.out.print(\"s:\" + s);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X26.java (at line 7)\n" +
+ " if ((o instanceof String s) && (p instanceof String s)) {\n" +
+ " ^\n" +
+ "Duplicate local variable s\n" +
+ "----------\n",
+ "",
+ null,
+ true,
+ options);
+ }
+ /*
+ * It's not allowed to have two pattern variables with same name in the
+ * same scope
+ */
+ public void test026a() {
+ Map<String, String> options = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X26.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X26 {\n" +
+ " public static void main(String[] o) {\n" +
+ " foo(\"one\", \"two\");\n" +
+ " }\n" +
+ " public static void foo(Object o, Object p) {\n" +
+ " if ((o instanceof String s) && (!(o instanceof String s))) {\n" +
+ " System.out.print(\"s:\" + s);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X26.java (at line 7)\n" +
+ " if ((o instanceof String s) && (!(o instanceof String s))) {\n" +
+ " ^\n" +
+ "Duplicate local variable s\n" +
"----------\n",
"",
null,
@@ -1347,7 +1536,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
* It's not a problem to define the same var in two operands of a binary expression,
* but then it is not in scope below.
*/
- public void test026() {
+ public void test026b() {
Map<String, String> options = getCompilerOptions(true);
runNegativeTest(
new String[] {
@@ -1368,7 +1557,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X26.java (at line 8)\n" +
" System.out.print(\"s:\" + s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1456,7 +1645,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X30.java (at line 8)\n" +
" System.out.print(s.charAt(i));\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n",
"",
null,
@@ -1483,17 +1672,17 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X31.java (at line 7)\n" +
" for(int i = 0; !(obj instanceof String[] s) && s.length > 0 && i < s.length; i++) {\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X31.java (at line 7)\n" +
" for(int i = 0; !(obj instanceof String[] s) && s.length > 0 && i < s.length; i++) {\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n" +
"3. ERROR in X31.java (at line 8)\n" +
" System.out.println(s[i]);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1552,7 +1741,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X33.java (at line 12)\n" +
" res = s.substring(1);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved\n" +
"----------\n",
"",
null,
@@ -1622,12 +1811,12 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X35.java (at line 11)\n" +
" yield s;\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n" +
"2. ERROR in X35.java (at line 14)\n" +
" yield s;\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -1706,16 +1895,13 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"1. ERROR in X38.java (at line 10)\n" +
" System.out.println(s);\n" +
" ^\n" +
- "The pattern variable s is not in scope in this location\n" +
+ "s cannot be resolved to a variable\n" +
"----------\n",
"",
null,
true,
getCompilerOptions(true));
}
- /*
- * Failing with VerifyError
- */
public void test039() {
runConformTest(
new String[] {
@@ -1813,7 +1999,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"else_x",
getCompilerOptions(true));
}
- public void _test043() {
+ public void test043() {
runConformTest(
new String[] {
"X43.java",
@@ -1826,11 +2012,11 @@ public class PatternMatching14Test extends AbstractRegressionTest {
" class Inner {\n" +
" public boolean foo(Object obj) {\n" +
" if (obj instanceof String s) {\n" +
- " // x is shadowed now\n" +
+ " // s is shadowed now\n" +
" if (!\"foo\".equals(s))\n" +
" return false;\n" +
" }\n" +
- " // x is not shadowed\n" +
+ " // s is not shadowed\n" +
" return \"test\".equals(s);\n" +
" }\n" +
" }\n" +
@@ -1838,7 +2024,7 @@ public class PatternMatching14Test extends AbstractRegressionTest {
" }\n" +
"}\n",
},
- "else_x",
+ "true",
getCompilerOptions(true));
}
public void test044() {
@@ -2671,4 +2857,339 @@ public class PatternMatching14Test extends AbstractRegressionTest {
"PASS",
compilerOptions);
}
+ public void test062() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " @SuppressWarnings(\"preview\")\n"+
+ " public void foo(Object o) {\n"+
+ " int len = (o instanceof String p) ? test(p -> p.length()) : test(p -> p.length());\n"+
+ " }\n"+
+ " public int test(FI fi) {\n" +
+ " return fi.length(\"\");\n" +
+ " } \n" +
+ " interface FI {\n" +
+ " public int length(String str);\n" +
+ " }" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " int len = (o instanceof String p) ? test(p -> p.length()) : test(p -> p.length());\n" +
+ " ^\n" +
+ "Lambda expression\'s parameter p cannot redeclare another local variable defined in an enclosing scope. \n" +
+ "----------\n",
+ "",
+ null,
+ true,
+ compilerOptions);
+ }
+ // Same as above, but pattern variable in scope in false of conditional expression
+ public void test063() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " @SuppressWarnings(\"preview\")\n"+
+ " public void foo(Object o) {\n"+
+ " int len = !(o instanceof String p) ? test(p -> p.length()) : test(p -> p.length());\n"+
+ " }\n"+
+ " public int test(FI fi) {\n" +
+ " return fi.length(\"\");\n" +
+ " } \n" +
+ " interface FI {\n" +
+ " public int length(String str);\n" +
+ " }" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " int len = !(o instanceof String p) ? test(p -> p.length()) : test(p -> p.length());\n" +
+ " ^\n" +
+ "Lambda expression\'s parameter p cannot redeclare another local variable defined in an enclosing scope. \n" +
+ "----------\n",
+ "",
+ null,
+ true,
+ compilerOptions);
+ }
+ public void test064() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"+
+ " public static void main(String argv[]) {\n" +
+ " System.out.println(new X().foo(\"foo\", \"test\"));\n" +
+ " }\n" +
+ " public boolean foo(Object obj, String s) {\n" +
+ " class Inner {\n" +
+ " public boolean foo(Object obj) {\n" +
+ " if (obj instanceof String s) {\n" +
+ " // s is shadowed now\n" +
+ " if (\"foo\".equals(s))\n" +
+ " return false;\n" +
+ " } else if (obj instanceof String s) { \n" +
+ " }\n"+
+ " // s is not shadowed\n" +
+ " return \"test\".equals(s);\n" +
+ " }\n" +
+ " }\n" +
+ " return new Inner().foo(obj);\n" +
+ " }" +
+ "}",
+ },
+ "false",
+ compilerOptions);
+ }
+ public void test065() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"+
+ " public static void main(String argv[]) {\n"
+ + " new X().foo(\"foo\");\n"
+ + " }\n"
+ + " public void foo(Object o) {\n"
+ + " if ((o instanceof String s)) {\n"
+ + " System.out.println(\"if:\" + s);\n"
+ + " } else {\n"
+ + " throw new IllegalArgumentException();\n"
+ + " }\n"
+ + " System.out.println(\"after:\" + s);\n"
+ + " }" +
+ "}",
+ },
+ "if:foo\n" +
+ "after:foo",
+ compilerOptions);
+ }
+ public void test066() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " protected Object x = \"FIELD X\";\n"
+ + " public void f(Object obj, boolean b) {\n"
+ + " if ((x instanceof String x)) {\n"
+ + " System.out.println(x.toLowerCase());\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " new X().f(Integer.parseInt(\"1\"), false);\n"
+ + " }\n"
+ + "}",
+ },
+ "field x",
+ compilerOptions);
+ }
+ public void test067() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " protected String x = \"FIELD X\";\n"
+ + " public void f(Object obj, boolean b) {\n"
+ + " if ((x instanceof String x) && x.length() > 0) {\n"
+ + " System.out.println(x.toLowerCase());\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " new X().f(Integer.parseInt(\"1\"), false);\n"
+ + " }\n"
+ + "}",
+ },
+ "field x",
+ compilerOptions);
+ }
+ public void test068() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " if (o instanceof X x || o instanceof X) {\n"
+ + " System.out.println(\"X\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "X",
+ compilerOptions);
+ }
+ public void test069() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " if (o instanceof X x && x instanceof X x) {\n"
+ + " System.out.println(\"X\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (o instanceof X x && x instanceof X x) {\n" +
+ " ^\n" +
+ "Duplicate local variable x\n" +
+ "----------\n",
+ null,
+ true,
+ compilerOptions);
+ }
+ // Javac rejects this. Need to check with the spec authors
+ public void test070() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " if (o instanceof X x || o instanceof X x) {\n"
+ + " System.out.println(\"X\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "X",
+ compilerOptions);
+ }
+ // Javac rejects the code on the IF itself (same as above)
+ public void test071() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " if (o instanceof X x || o instanceof X x) {\n"
+ + " System.out.println(x);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " System.out.println(x);\n" +
+ " ^\n" +
+ "x cannot be resolved to a variable\n" +
+ "----------\n",
+ null,
+ true,
+ compilerOptions);
+ }
+ // Javac rejects the code on the IF itself (same as above)
+ public void test072() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " if (o instanceof X x || o instanceof X x) {\n"
+ + " throw new IllegalArgumentException();\n"
+ + " }\n"
+ + " System.out.println(x);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " System.out.println(x);\n" +
+ " ^\n" +
+ "x cannot be resolved to a variable\n" +
+ "----------\n",
+ null,
+ true,
+ compilerOptions);
+ }
+ public void test073() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runConformTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " try {\n"
+ + " if (!(o instanceof X x) || x != null || x!= null) { // allowed \n"
+ + " throw new IllegalArgumentException();\n"
+ + " }\n"
+ + " System.out.println(x); // allowed \n"
+ + " } catch (Throwable e) {\n"
+ + " e.printStackTrace(System.out);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "java.lang.IllegalArgumentException\n" +
+ " at X.foo(X.java:6)\n" +
+ " at X.main(X.java:14)",
+ compilerOptions);
+ }
+ public void test074() {
+ Map<String, String> compilerOptions = getCompilerOptions(true);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"+
+ "public class X {\n"
+ + " static void foo(Object o) {\n"
+ + " if (!(o instanceof X x) || x != null || x!= null) {\n"
+ + " System.out.println(x);\n // not allowed"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " foo(new X());\n"
+ + " }\n"
+ + "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " System.out.println(x);\n" +
+ " ^\n" +
+ "x cannot be resolved to a variable\n" +
+ "----------\n",
+ null,
+ true,
+ compilerOptions);
+ }
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
index 8aa63ad5af..9031689c0d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
@@ -29,14 +29,14 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testBug564146"};
+// TESTS_NAMES = new String[] { "testBug566418_001"};
}
public static Class<?> testClass() {
return RecordsRestrictedClassTest.class;
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_14);
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
}
public RecordsRestrictedClassTest(String testName){
super(testName);
@@ -45,9 +45,9 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
// Enables the tests to run individually
protected Map<String, String> getCompilerOptions() {
Map<String, String> defaultOptions = super.getCompilerOptions();
- defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14); // FIXME
- defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15); // FIXME
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
defaultOptions.put(CompilerOptions.OPTION_Store_Annotations, CompilerOptions.ENABLED);
@@ -59,20 +59,19 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
runConformTest(testFiles, expectedOutput, getCompilerOptions());
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- protected void runConformTest(String[] testFiles, String expectedOutput, Map customOptions) {
+ protected void runConformTest(String[] testFiles, String expectedOutput, Map<String, String> customOptions) {
Runner runner = new Runner();
runner.testFiles = testFiles;
runner.expectedOutputString = expectedOutput;
runner.vmArguments = new String[] {"--enable-preview"};
runner.customOptions = customOptions;
- runner.javacTestOptions = JavacTestOptions.forReleaseWithPreview("14");
+ runner.javacTestOptions = JavacTestOptions.forReleaseWithPreview("15");
runner.runConformTest();
}
@Override
protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
- runNegativeTest(testFiles, expectedCompilerLog, JavacTestOptions.forReleaseWithPreview("14"));
+ runNegativeTest(testFiles, expectedCompilerLog, JavacTestOptions.forReleaseWithPreview("15"));
}
protected void runWarningTest(String[] testFiles, String expectedCompilerLog) {
runWarningTest(testFiles, expectedCompilerLog, null);
@@ -88,8 +87,8 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
runner.expectedCompilerLog = expectedCompilerLog;
runner.customOptions = customOptions;
runner.vmArguments = new String[] {"--enable-preview"};
- runner.javacTestOptions = javacAdditionalTestOptions == null ? JavacTestOptions.forReleaseWithPreview("14") :
- JavacTestOptions.forReleaseWithPreview("14", javacAdditionalTestOptions);
+ runner.javacTestOptions = javacAdditionalTestOptions == null ? JavacTestOptions.forReleaseWithPreview("15") :
+ JavacTestOptions.forReleaseWithPreview("15", javacAdditionalTestOptions);
runner.runWarningTest();
}
@@ -429,7 +428,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"1. ERROR in X.java (at line 7)\n" +
" private Point {\n" +
" ^^^^^\n" +
- "The canonical constructor Point of a record declaration must be declared public.\n" +
+ "Cannot reduce the visibility of a canonical constructor Point from that of the record\n" +
"----------\n");
}
public void testBug550750_020() {
@@ -449,31 +448,17 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"}\n" +
"interface I {}\n"
},
- "----------\n" +
- "1. ERROR in X.java (at line 7)\n" +
- " protected Point {\n" +
- " ^^^^^\n" +
- "The canonical constructor Point of a record declaration must be declared public.\n" +
- "----------\n");
- }
- public void testBug550750_021() {
- runConformTest(
- new String[] {
- "X.java",
- "public class X {\n"+
- " public static void main(String[] args){\n"+
- " System.out.println(0);\n" +
- " }\n"+
- "}\n"+
- "record Point(int myInt, char myChar) implements I {\n"+
- " public Point {\n"+
- " this.myInt = myInt;\n" +
- " this.myChar = myChar;\n" +
- " }\n"+
- "}\n" +
- "interface I {}\n"
- },
- "0");
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " this.myInt = myInt;\n" +
+ " ^^^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myInt in compact constructor\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " this.myChar = myChar;\n" +
+ " ^^^^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myChar in compact constructor\n" +
+ "----------\n");
}
public void testBug550750_022() {
this.runNegativeTest(
@@ -633,6 +618,16 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
" static final int z;\n" +
" ^\n" +
"The blank final field z may not have been initialized\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " this.myInt = myInt;\n" +
+ " ^^^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myInt in compact constructor\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 10)\n" +
+ " this.myZ = myZ;\n" +
+ " ^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myZ in compact constructor\n" +
"----------\n");
}
public void testBug550750_028() {
@@ -742,7 +737,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"1. ERROR in X.java (at line 1)\n" +
" class record {\n" +
" ^^^^^^\n" +
- "Record is a restricted identifier and hence not a valid type name\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n");
}
public void testBug550750_033() {
@@ -759,7 +754,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"1. ERROR in X.java (at line 1)\n" +
" class X<record> {\n" +
" ^^^^^^\n" +
- "Record is a restricted identifier and hence not a valid type name\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n");
}
public void testBug550750_034() {
@@ -777,7 +772,12 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"1. ERROR in X.java (at line 5)\n" +
" public <record> void foo(record args){}\n" +
" ^^^^^^\n" +
- "Record is a restricted identifier and hence not a valid type name\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " public <record> void foo(record args){}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n");
}
public void testBug550750_035() {
@@ -795,12 +795,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"1. ERROR in X.java (at line 5)\n" +
" public void foo(record args){}\n" +
" ^^^^^^\n" +
- "record cannot be resolved to a type\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 5)\n" +
- " public void foo(record args){}\n" +
- " ^^^^^^\n" +
- "Record is a restricted identifier and hence not a valid type name\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n");
}
public void testBug550750_036() {
@@ -826,12 +821,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"2. ERROR in X.java (at line 4)\n" +
" I lambda = (record r) -> {};\n" +
" ^^^^^^\n" +
- "record cannot be resolved to a type\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 4)\n" +
- " I lambda = (record r) -> {};\n" +
- " ^^^^^^\n" +
- "Record is a restricted identifier and hence not a valid type name\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n");
}
public void testBug550750_037() {
@@ -1105,14 +1095,24 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
" ^^^^^\n" +
"Duplicate method Point(Integer, int) in type Point\n" +
"----------\n" +
- "2. ERROR in X.java (at line 11)\n" +
+ "2. ERROR in X.java (at line 8)\n" +
+ " this.myInt = 0;\n" +
+ " ^^^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myInt in compact constructor\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 9)\n" +
+ " this.myZ = 0;\n" +
+ " ^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myZ in compact constructor\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 11)\n" +
" public Point(Integer myInt, int myZ) {\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"Duplicate method Point(Integer, int) in type Point\n" +
"----------\n");
}
public void testBug553152_009() {
- this.runNegativeTest(
+ this.runConformTest(
new String[] {
"X.java",
"public class X {\n"+
@@ -1128,12 +1128,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"}\n" +
"interface I {}\n"
},
- "----------\n" +
- "1. ERROR in X.java (at line 7)\n" +
- " Point(Integer myInt, int myZ) {\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The canonical constructor Point of a record declaration must be declared public.\n" +
- "----------\n");
+ "0");
}
public void testBug553152_010() {
this.runNegativeTest(
@@ -1336,7 +1331,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"Nested Record is (implicitly) static and hence enclosing type should be static\n" +
"----------\n");
}
- public void _testBug553152_018() {
+ public void testBug553152_018() {
runConformTest(
new String[] {
"X.java",
@@ -1376,25 +1371,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
"The accessor method must not be static\n" +
"----------\n");
}
-public void testBug553153_01() {
- runConformTest(
- new String[] {
- "X.java",
- "public class X {\n"+
- " public static void main(String[] args){\n"+
- " System.out.println(0);\n" +
- " }\n"+
- "}\n"+
- "record Point(int myInt, char myChar) implements I {\n"+
- " public Point {\n"+
- " this.myInt = myInt;\n" +
- " }\n"+
- "}\n" +
- "interface I {}\n"
- },
- "0");
- }
- public void testBug553153_002() {
+public void testBug553153_002() {
this.runNegativeTest(
new String[] {
"X.java",
@@ -1413,10 +1390,20 @@ public void testBug553153_01() {
"interface I {}\n"
},
"----------\n" +
- "1. ERROR in X.java (at line 7)\n" +
- " public Point {\n" +
- " ^^^^^\n" +
- "The blank final field myChar may not have been initialized\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " this.myInt = myInt;\n" +
+ " ^^^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myInt in compact constructor\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " if (this.myInt > 0) // conditional assignment\n" +
+ " ^^^^^\n" +
+ "The blank final field myInt may not have been initialized\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 10)\n" +
+ " this.myChar = myChar;\n" +
+ " ^^^^^^^^^^^\n" +
+ "Illegal explicit assignment of a final field myChar in compact constructor\n" +
"----------\n");
}
public void testBug553153_003() {
@@ -1431,7 +1418,6 @@ public void testBug553153_003() {
"record Point(int myInt, char myChar) implements I {\n"+
" static int f;\n"+
" public Point {\n"+
- " this.myInt = myInt;\n" +
" }\n"+
"}\n" +
"interface I {}\n"
@@ -2337,7 +2323,7 @@ public void testBug560893_006() {
"X.java",
"class X {\n"+
" public static void main(String[] args) {\n"+
- " static record R(int x, int y) {}\n"+
+ " record R(int x, int y) {}\n"+
" R r = new R(100,200);\n"+
" System.out.println(r.x());\n"+
" }\n"+
@@ -2371,7 +2357,7 @@ public void testBug560893_007() {
"1. ERROR in X.java (at line 10)\n" +
" System.out.println(li); // error, local variable\n" +
" ^^\n" +
- "Cannot make a static reference to the non-static variable li from a local record\n" +
+ "Cannot make a static reference to the non-static variable li\n" +
"----------\n" +
"2. ERROR in X.java (at line 11)\n" +
" System.out.println(nsi); // error, non-static member\n" +
@@ -2392,7 +2378,7 @@ public void testBug558718_001() {
"1. ERROR in X.java (at line 1)\n" +
" record R() {}\n" +
" ^^^^^^\n" +
- "record is a preview feature and disabled by default. Use --enable-preview to enable\n" +
+ "Records is a preview feature and disabled by default. Use --enable-preview to enable\n" +
"----------\n",
null,
true,
@@ -2413,7 +2399,7 @@ public void testBug558718_002() {
"1. ERROR in X.java (at line 1)\n" +
" record R() {}\n" +
" ^^^^^^\n" +
- "Syntax error on token \"record\", @ expected\n" +
+ "The preview feature Records is only available with source level 15 and above\n" +
"----------\n" +
"2. ERROR in X.java (at line 1)\n" +
" record R() {}\n" +
@@ -2425,6 +2411,22 @@ public void testBug558718_002() {
options
);
}
+public void testBug56180_001() throws Exception {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "record R () {} \n"+
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(new R().toString());\n"+
+ " }\n"+
+ "}\n"
+ },
+ "R[]");
+ String expectedOutput =
+ " public final java.lang.String toString();\n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "R.class", ClassFileBytesDisassembler.SYSTEM);
+}
public void testBug561528_001() {
runConformTest(
new String[] {
@@ -3279,6 +3281,10 @@ public void testBug562439_013() throws IOException, ClassFormatException {
" RuntimeInvisibleAnnotations: \n" +
" #8 @RCMU(\n" +
" )\n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #8 @RCMU(\n" +
+ " target type = 0x14 METHOD_RETURN\n" +
+ " )\n" +
" \n";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
@@ -3392,9 +3398,11 @@ public void testBug562439_015() throws IOException, ClassFormatException {
" 4 ireturn\n" +
" Line numbers:\n" +
" [pc: 0, line: 11]\n" +
- " RuntimeInvisibleAnnotations: \n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
" #8 @T(\n" +
- " )\n";
+ " target type = 0x14 METHOD_RETURN\n" +
+ " )\n" +
+ " ";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
"Record: #Record\n" +
@@ -3408,7 +3416,7 @@ public void testBug562439_015() throws IOException, ClassFormatException {
" )\n";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
- " public Point(int myInt, char myChar);\n" +
+ " Point(int myInt, char myChar);\n" +
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Record() [14]\n" +
" 4 aload_0 [this]\n" +
@@ -3471,10 +3479,11 @@ public void testBug562439_016() throws IOException, ClassFormatException {
" 4 ireturn\n" +
" Line numbers:\n" +
" [pc: 0, line: 13]\n" +
- " RuntimeVisibleAnnotations: \n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
" #8 @T(\n" +
+ " target type = 0x14 METHOD_RETURN\n" +
" )\n" +
- " \n";
+ " ";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
"Record: #Record\n" +
@@ -3488,7 +3497,7 @@ public void testBug562439_016() throws IOException, ClassFormatException {
" )\n";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
- " public Point(int myInt, char myChar);\n" +
+ " Point(int myInt, char myChar);\n" +
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Record() [14]\n" +
" 4 aload_0 [this]\n" +
@@ -3533,7 +3542,7 @@ public void testBug562439_017() throws IOException, ClassFormatException {
},
"100");
String expectedOutput =
- " public Point(int myInt, char myChar);\n" +
+ " Point(int myInt, char myChar);\n" +
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Record() [14]\n" +
" 4 aload_0 [this]\n" +
@@ -3591,7 +3600,7 @@ public void testBug562439_018() throws IOException, ClassFormatException {
},
"100");
String expectedOutput =
- " public Point(int myInt, char myChar);\n" +
+ " Point(int myInt, char myChar);\n" +
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Record() [14]\n" +
" 4 aload_0 [this]\n" +
@@ -3657,7 +3666,7 @@ public void testBug562439_019() throws IOException, ClassFormatException {
" \n";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
- " public Point(int myInt, char myChar);\n" +
+ " Point(int myInt, char myChar);\n" +
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Record() [16]\n" +
" 4 aload_0 [this]\n" +
@@ -3697,7 +3706,11 @@ public void testBug562439_019() throws IOException, ClassFormatException {
" RuntimeInvisibleAnnotations: \n" +
" #8 @Annot(\n" +
" )\n" +
- " \n";
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #8 @Annot(\n" +
+ " target type = 0x14 METHOD_RETURN\n" +
+ " )\n" +
+ " ";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
expectedOutput =
"Record: #Record\n" +
@@ -3738,7 +3751,7 @@ public void testBug562439_020() throws IOException, ClassFormatException {
},
"100");
String expectedOutput =
- " public Point(int myInt, char myChar);\n" +
+ " Point(int myInt, char myChar);\n" +
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Record() [14]\n" +
" 4 aload_0 [this]\n" +
@@ -3772,136 +3785,3818 @@ public void testBug562439_020() throws IOException, ClassFormatException {
" )\n";
RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
}
-public void testBug564146_001() {
+public void testBug563178_001() {
this.runNegativeTest(
new String[] {
"X.java",
- "public record X(int i) {\n"+
- " public X() {\n"+
- " this.i = 10;\n"+
+ "class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"+
+ "record Point(final int x, int y){\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " record Point(final int x, int y){\n" +
+ " ^\n" +
+ "A record component x cannot have modifiers\n" +
+ "----------\n");
+}
+public void testBug563183_001() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " public X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_002() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " public X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_003() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " protected X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
" }\n"+
"}",
},
"----------\n" +
"1. ERROR in X.java (at line 2)\n" +
- " public X() {\n" +
- " ^^^\n" +
- "A non-canonical constructor must start with an explicit invocation to a constructor\n" +
+ " protected X() {}\n" +
+ " ^^^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
"----------\n");
}
-public void testBug564146_002() {
+public void testBug563183_004() {
this.runNegativeTest(
new String[] {
"X.java",
- "public record X(int i) {\n"+
- " public X() {\n"+
- " super();\n"+
- " this.i = 10;\n"+
+ "public record X() {\n"+
+ " protected X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
" }\n"+
"}",
},
"----------\n" +
"1. ERROR in X.java (at line 2)\n" +
- " public X() {\n" +
- " ^^^\n" +
- "A non-canonical constructor must start with an explicit invocation to a constructor\n" +
+ " protected X {}\n" +
+ " ^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
"----------\n");
}
-public void testBug564146_003() {
+public void testBug563183_005() {
this.runNegativeTest(
new String[] {
"X.java",
- "public record X(int i) {\n"+
- " public X(int i) {\n"+
- " this.i = 10;\n"+
- " Zork();\n"+
+ "public record X() {\n"+
+ " /*package */ X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
" }\n"+
"}",
},
"----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " Zork();\n" +
- " ^^^^\n" +
- "The method Zork() is undefined for the type X\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " /*package */ X() {}\n" +
+ " ^^^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
"----------\n");
}
-public void testBug564146_004() {
- runConformTest(
+public void testBug563183_006() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " /*package */ X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " /*package */ X {}\n" +
+ " ^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_007() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " private X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " private X() {}\n" +
+ " ^^^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_008() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " private X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " private X {}\n" +
+ " ^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_009() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " public R() {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_010() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " public R {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_011() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " protected R() {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_012() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " protected R {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_013() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " /*package */ R() {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " /*package */ R() {}\n" +
+ " ^^^\n" +
+ "Cannot reduce the visibility of a canonical constructor R from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_014() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " /*package */ R {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " /*package */ R {}\n" +
+ " ^\n" +
+ "Cannot reduce the visibility of a canonical constructor R from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_015() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " private R() {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " private R() {}\n" +
+ " ^^^\n" +
+ "Cannot reduce the visibility of a canonical constructor R from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_016() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " protected record R() {\n"+
+ " private R {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " private R {}\n" +
+ " ^\n" +
+ "Cannot reduce the visibility of a canonical constructor R from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_017() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "/*package */ record X() {\n"+
+ " public X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_018() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "/*package */ record X() {\n"+
+ " public X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_019() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "record X() {\n"+
+ " protected X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_020() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "record X() {\n"+
+ " protected X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_021() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ " record X() {\n"+
+ " /*package */ X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_022() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ " record X() {\n"+
+ " /*package */ X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_023() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X() {\n"+
+ " private X() {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " private X() {}\n" +
+ " ^^^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_024() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X() {\n"+
+ " private X {}\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " private X {}\n" +
+ " ^\n" +
+ "Cannot reduce the visibility of a canonical constructor X from that of the record\n" +
+ "----------\n");
+}
+public void testBug563183_025() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record R() {\n"+
+ " public R() {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_026() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record R() {\n"+
+ " protected R {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_027() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record R() {\n"+
+ " /* package */ R() {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563183_028() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record R() {\n"+
+ " private R {}\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug563184_001() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X(int angel) {\n"+
+ " X(int devil) {\n"+
+ " this.angel = devil;\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " X(int devil) {\n" +
+ " ^^^^^\n" +
+ "Illegal parameter name devil in canonical constructor, expected angel, the corresponding component name\n" +
+ "----------\n");
+}
+public void testBug563184_002() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "record X(int myInt) {\n"+
+ " X(int myInt) {\n"+
+ " this.myInt = myInt;\n" +
+ " }\n"+
+ " X(int i, int j) {\n"+
+ " this(i);\n"+
+ " }\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}",
+ },
+ "0");
+}
+public void testBug562637_001() {
+ this.runConformTest(
new String[] {
"X.java",
"public record X(int i) {\n"+
+ " public X {\n"+
+ " i = i/2;\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(new X(10).i());\n"+
+ " }\n"+
+ "}",
+ },
+ "5");
+}
+ public void testBug563181_01() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.ElementType;\n"+
+ "import java.lang.annotation.Target;\n"+
+ "public class X { \n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"+
+ "record Point(@RCMU int myInt, char myChar) { \n"+
+ " public int myInt(){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ "} \n"+
+ "@Target({ ElementType.RECORD_COMPONENT, ElementType.METHOD, ElementType.TYPE_USE})\n"+
+ "@interface RCMU {}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Method descriptor #25 ()I\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public int myInt();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 getfield Point.myInt : int [17]\n" +
+ " 4 ireturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 8]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: Point\n" +
+ " \n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug563181_02() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.ElementType;\n"+
+ "import java.lang.annotation.Target;\n"+
+ "public class X { \n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"+
+ "record Point(@RCMU int myInt, char myChar) {\n"+
+ " @RCMU public int myInt(){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ "}\n"+
+ "@Target({ ElementType.RECORD_COMPONENT, ElementType.METHOD, ElementType.TYPE_USE})\n"+
+ "@interface RCMU {}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Method descriptor #25 ()I\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public int myInt();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 getfield Point.myInt : int [17]\n" +
+ " 4 ireturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 8]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: Point\n" +
+ " RuntimeInvisibleAnnotations: \n" +
+ " #8 @RCMU(\n" +
+ " )\n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #8 @RCMU(\n" +
+ " target type = 0x14 METHOD_RETURN\n" +
+ " )\n" +
+ " \n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug563181_03() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n"+
+ "public class X { \n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"+
+ "record Point(@TypeAnnot @SimpleAnnot int myInt, char myChar) {}\n"+
+ "@Target({ ElementType.RECORD_COMPONENT, ElementType.METHOD})\n"+
+ "@Retention(RetentionPolicy.RUNTIME)\n" +
+ "@interface SimpleAnnot {}\n" +
+ "@Target({ ElementType.RECORD_COMPONENT, ElementType.TYPE_USE})\n"+
+ "@Retention(RetentionPolicy.RUNTIME)\n" +
+ "@interface TypeAnnot {}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Method descriptor #25 ()I\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public int myInt();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 getfield Point.myInt : int [17]\n" +
+ " 4 ireturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 5]\n" +
+ " RuntimeVisibleAnnotations: \n" +
+ " #27 @SimpleAnnot(\n" +
+ " )\n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
+ " #8 @TypeAnnot(\n" +
+ " target type = 0x14 METHOD_RETURN\n" +
+ " )\n" +
+ " \n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug563181_04() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n"+
+ "public class X { \n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"+
+ "record Point(@TypeAnnot @SimpleAnnot int myInt, char myChar) {\n"+
+ " @TypeAnnot @SimpleAnnot public int myInt(){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ "}\n"+
+ "@Target({ ElementType.RECORD_COMPONENT, ElementType.METHOD})\n"+
+ "@Retention(RetentionPolicy.RUNTIME)\n" +
+ "@interface SimpleAnnot {}\n" +
+ "@Target({ ElementType.RECORD_COMPONENT, ElementType.TYPE_USE})\n"+
+ "@Retention(RetentionPolicy.RUNTIME)\n" +
+ "@interface TypeAnnot {}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Method descriptor #25 ()I\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public int myInt();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 getfield Point.myInt : int [17]\n" +
+ " 4 ireturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 7]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: Point\n" +
+ " RuntimeVisibleAnnotations: \n" +
+ " #27 @SimpleAnnot(\n" +
+ " )\n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
+ " #8 @TypeAnnot(\n" +
+ " target type = 0x14 METHOD_RETURN\n" +
+ " )\n" +
+ " \n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "Point.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565104_001() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X { \n"+
+ " public record R() {}\n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Stack: 1, Locals: 1\n" +
+ " public X$R();\n" +
+ " 0 aload_0 [this]\n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "X$R.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565104_002() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X { \n"+
+ " record R() {}\n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Stack: 1, Locals: 1\n" +
+ " X$R();\n" +
+ " 0 aload_0 [this]\n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "X$R.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565104_003() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X { \n"+
+ " protected record R() {}\n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Stack: 1, Locals: 1\n" +
+ " protected X$R();\n" +
+ " 0 aload_0 [this]\n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "X$R.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565104_004() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X { \n"+
+ " private record R() {}\n"+
+ " public static void main(String[] args){}\n"+
+ "}\n"
+ },
+ "");
+ String expectedOutput =
+ " // Stack: 1, Locals: 1\n" +
+ " private X$R();\n" +
+ " 0 aload_0 [this]\n";
+ RecordsRestrictedClassTest.verifyClassFile(expectedOutput, "X$R.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug564146_001() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X(int i) {\n"+
+ " public X() {\n"+
+ " this.i = 10;\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public X() {\n" +
+ " ^^^\n" +
+ "A non-canonical constructor must start with an explicit invocation to a constructor\n" +
+ "----------\n");
+ }
+ public void testBug564146_002() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X(int i) {\n"+
+ " public X() {\n"+
+ " super();\n"+
+ " this.i = 10;\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public X() {\n" +
+ " ^^^\n" +
+ "A non-canonical constructor must start with an explicit invocation to a constructor\n" +
+ "----------\n");
+ }
+ public void testBug564146_003() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X(int i) {\n"+
+ " public X(int i) {\n"+
+ " this.i = 10;\n"+
+ " Zork();\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ public void testBug564146_004() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public record X(int i) {\n"+
+ " public X() {\n"+
+ " this(10);\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(new X().i());\n"+
+ " }\n"+
+ "}"
+ },
+ "10");
+ }
+ public void testBug564146_005() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
+ " public X(int i) {\n"+
+ " this(10);\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " this(10);\n" +
+ " ^^^^^^^^^\n" +
+ "Recursive constructor invocation X(int)\n" +
+ "----------\n");
+ }
+ public void testBug564146_006() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n"+
" public X() {\n"+
+ " System.out.println(10);\n"+
" this(10);\n"+
" }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " this(10);\n" +
+ " ^^^^^^^^^\n" +
+ "The body of a canonical constructor must not contain an explicit constructor call\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " this(10);\n" +
+ " ^^^^^^^^^\n" +
+ "Constructor call must be the first statement in a constructor\n" +
+ "----------\n");
+ }
+ public void testBug564146_007() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public record X(int i) {\n"+
+ " public X() {\n"+
+ " this(10);\n"+
+ " }\n"+
+ " public X(int i, int k) {\n"+
+ " this();\n"+
+ " }\n"+
" public static void main(String[] args) {\n"+
- " System.out.println(new X().i());\n"+
+ " System.out.println(new X(2, 3).i());\n"+
" }\n"+
"}"
+ },
+ "10");
+ }
+
+public void testBug564672_001() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "class record {}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " class record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_002() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_003() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "interface record {}\n;" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " interface record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_004() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_005() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ " class record {}\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " class record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_006() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_007() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " interface record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_008() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_009() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface Y extends record {\n"+
+ "}\n" +
+ "interface record {}\n" +
+ "class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " interface record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_010() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface Y extends record {\n"+
+ "}\n" +
+ "class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_011() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " interface record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_012() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_013() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ " class record {}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " class record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_014() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_015() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " interface record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_016() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_017() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " interface record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_018() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_019() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static record a(int i, int j) {\n" +
+ " record r=new record(i,j);\n" +
+ " return r;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " record r=new record(i,j);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " record r=new record(i,j);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 4)\n" +
+ " return r;\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"return\", byte expected\n" +
+ "----------\n");
+}
+public void testBug564672_020() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " class record {};\n" +
+ " static record a(int i, int j) {\n" +
+ " record r=new record();\n" +
+ " return r;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class record {};\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " record r=new record();\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 4)\n" +
+ " record r=new record();\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 5)\n" +
+ " return r;\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"return\", byte expected\n" +
+ "----------\n");
+}
+public void testBug564672_021() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " interface IPoint {\n" +
+ " }\n" +
+ " record Point(int x, int y) implements IPoint {}\n" +
+ " static IPoint a(int i, int j) {\n" +
+ " Point record=new Point(i,j);\n" +
+ " return record;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(a(5,10));\n" +
+ " }\n" +
+ "}\n"
+ },
+ "Point[x=5, y=10]");
+}
+public void testBug564672_022() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " record R(int i){} \n" +
+ " interface IPoint {\n" +
+ " record a(int i) {\n" +
+ " System.out.println(0);\n" +
+ " return new R(i);\n" +
+ " }\n" +
+ " }\n" +
+ " record Point(int x, int y) implements IPoint {}\n" +
+ " static IPoint a(int i, int j) {\n" +
+ " Point record=new Point(i,j);\n" +
+ " record.a(1);\n" +
+ " return record;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " System.out.println(0);\n" +
+ " ^\n" +
+ "Syntax error on token \".\", @ expected after this token\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " System.out.println(0);\n" +
+ " return new R(i);\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Syntax error on tokens, delete these tokens\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " return new R(i);\n" +
+ " ^\n" +
+ "Syntax error, insert \")\" to complete SingleMemberAnnotation\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 6)\n" +
+ " return new R(i);\n" +
+ " ^\n" +
+ "Syntax error, insert \"SimpleName\" to complete QualifiedName\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 6)\n" +
+ " return new R(i);\n" +
+ " ^\n" +
+ "Syntax error, insert \"Identifier (\" to complete MethodHeaderName\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 6)\n" +
+ " return new R(i);\n" +
+ " ^\n" +
+ "Syntax error, insert \")\" to complete MethodDeclaration\n" +
+ "----------\n" +
+ "7. ERROR in X.java (at line 11)\n" +
+ " Point record=new Point(i,j);\n" +
+ " ^^^^^^^^^^^^^^\n" +
+ "The constructor X.Point(int, int) is undefined\n" +
+ "----------\n" +
+ "8. ERROR in X.java (at line 12)\n" +
+ " record.a(1);\n" +
+ " ^\n" +
+ "The method a(int) is undefined for the type X.Point\n" +
+ "----------\n");
+}
+public void testBug564672_023() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " interface IPoint {\n" +
+ " }\n" +
+ " record Point(int x, int y) implements IPoint {}\n" +
+ " static IPoint a(int i, int j) throws record{\n" +
+ " Point record=new Point(i,j);\n" +
+ " return record;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " static IPoint a(int i, int j) throws record{\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_024() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " X() throws record {} \n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " X() throws record {} \n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_025() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n" +
+ " int a() throws record; \n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " int a() throws record; \n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_026() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "import java.util.List;" +
+ "public class X {\n" +
+ " List<record> R = new List<record>();\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " List<record> R = new List<record>();\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " List<record> R = new List<record>();\n" +
+ " ^^^^\n" +
+ "Cannot instantiate the type List<record>\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 2)\n" +
+ " List<record> R = new List<record>();\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_027() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface I<S> {\n" +
+ " void print(S arg);\n" +
+ "}\n" +
+ "public class X implements I<record>{\n" +
+ " void print(record arg){\n" +
+ " System.out.println(arg);\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " public class X implements I<record>{\n" +
+ " ^\n" +
+ "The type X must implement the inherited abstract method I<record>.print(record)\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " public class X implements I<record>{\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " void print(record arg){\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_028() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Y<record> {\n" +
+ " void equal(record R) {}\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class Y<record> {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " void equal(record R) {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_029() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Y<record> {\n" +
+ " Y(record R) {}\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class Y<record> {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " Y(record R) {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_030() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static record i= 0;\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " static record i= 0;\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_031() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface I {\n" +
+ " record i=0;\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " record i=0;\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_032() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static int sum(record i, int param){\n" +
+ " return 1;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " static int sum(record i, int param){\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_033() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " X(record i, int param){\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " X(record i, int param){\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_034() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface I {\n" +
+ " int sum(record i, int num);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " int sum(record i, int num);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_035() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Greetings {\n" +
+ " void greet(String head, String tail);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " Greetings g = (record, y) -> {\n" +
+ " System.out.println(record + y);\n" +
+ " };\n" +
+ " g.greet(\"Hello, \", \"World!\");\n" +
+ " }\n" +
+ "}\n",
},
- "10");
+ "Hello, World!"
+ );
}
-public void testBug564146_005() {
+public void testBug564672_036() {
this.runNegativeTest(
new String[] {
"X.java",
- "public record X() {\n"+
- " public X(int i) {\n"+
- " this(10);\n"+
- " }\n"+
- "}",
+ "class Y {\n" +
+ " int sum(record this, int i, int num) {}\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " int sum(record this, int i, int num) {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_037() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static record i;\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " static record i;\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_038() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " for (record i = 0; i<10; i++) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
- " this(10);\n" +
- " ^^^^^^^^^\n" +
- "Recursive constructor invocation X(int)\n" +
+ " for (record i = 0; i<10; i++) {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n");
}
-public void testBug564146_006() {
+public void testBug564672_039() {
this.runNegativeTest(
new String[] {
"X.java",
- "public record X() {\n"+
- " public X() {\n"+
- " System.out.println(10);\n"+
- " this(10);\n"+
- " }\n"+
- "}",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " int rec[] = {1,2,3,4,5,6,7,8,9};\n" +
+ " for (record i: rec) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
- " this(10);\n" +
- " ^^^^^^^^^\n" +
- "The body of a canonical constructor must not contain an explicit constructor call\n" +
+ " for (record i: rec) {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
- " this(10);\n" +
- " ^^^^^^^^^\n" +
- "Constructor call must be the first statement in a constructor\n" +
+ " for (record i: rec) {\n" +
+ " ^^^\n" +
+ "Type mismatch: cannot convert from element type int to record\n" +
"----------\n");
}
-public void testBug564146_007() {
- runConformTest(
+public void testBug564672_040() {
+ this.runNegativeTest(
new String[] {
"X.java",
- "public record X(int i) {\n"+
- " public X() {\n"+
- " this(10);\n"+
- " }\n"+
- " public X(int i, int k) {\n"+
- " this();\n"+
- " }\n"+
- " public static void main(String[] args) {\n"+
- " System.out.println(new X(2, 3).i());\n"+
- " }\n"+
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " try (record i = 0){\n" +
+ " }\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " try (record i = 0){\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_041() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " try{\n" +
+ " }\n" +
+ " catch (record e) {}\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " catch (record e) {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_042() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record Point(record x, int i) { }\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " record Point(record x, int i) { }\n" +
+ " ^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " record Point(record x, int i) { }\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_043() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Point {\n" +
+ " <T> Point(T i) {\n" +
+ " }\n" +
+ " Point (int i, int j) {\n" +
+ " <record> this(null);\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " <record> this(null);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " <record> this(null);\n" +
+ " ^^^^^^^^^^^\n" +
+ "The constructor Point(record) refers to the missing type record\n" +
+ "----------\n");
+}
+public void testBug564672_044() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Point {\n" +
+ " <T> Point(T i) {\n" +
+ " }\n" +
+ "}\n" +
+ "class PointEx extends Point {\n" +
+ " PointEx (int i, int j) {\n" +
+ " <record> super(null);\n" +
+ " }\n;" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " <record> super(null);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 7)\n" +
+ " <record> super(null);\n" +
+ " ^^^^^^^^^^^^\n" +
+ "The constructor Point(record) refers to the missing type record\n" +
+ "----------\n");
+}
+public void testBug564672_045() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Y {\n" +
+ " void m1() {} \n" +
+ " void m2() {\n" +
+ " this.<record>m1();" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " this.<record>m1(); }\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 4)\n" +
+ " this.<record>m1(); }\n" +
+ " ^^^^^^\n" +
+ "Unused type arguments for the non generic method m1() of type Y; it should not be parameterized with arguments <record>\n" +
+ "----------\n");
+}
+public void testBug564672_046() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Y{\n" +
+ " void a() {\n" +
+ " System.out.println(\"1\");\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " new <record>Y().a();\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " new <record>Y().a();\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 8)\n" +
+ " new <record>Y().a();\n" +
+ " ^^^^^^\n" +
+ "Unused type arguments for the non generic constructor Y() of type Y; it should not be parameterized with arguments <record>\n" +
+ "----------\n");
+}
+public void testBug564672_047() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface Y{}\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " new <record>Y() {\n" +
+ " void a() {\n" +
+ " System.out.println(\"1\");\n" +
+ " }\n" +
+ " }.a();\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " new <record>Y() {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 5)\n" +
+ " new <record>Y() {\n" +
+ " ^^^^^^\n" +
+ "Unused type arguments for the non generic constructor Object() of type Object; it should not be parameterized with arguments <record>\n" +
+ "----------\n");
+}
+public void testBug564672_048() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class Y{}\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " new <record>Y() {\n" +
+ " void a() {\n" +
+ " System.out.println(\"1\");\n" +
+ " }\n" +
+ " }.a();\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " new <record>Y() {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 5)\n" +
+ " new <record>Y() {\n" +
+ " ^^^^^^\n" +
+ "Unused type arguments for the non generic constructor Y() of type Y; it should not be parameterized with arguments <record>\n" +
+ "----------\n");
+}
+public void testBug564672_049() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " record[] y= new record[3]; \n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " record[] y= new record[3]; \n" +
+ " ^^^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " record[] y= new record[3]; \n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_050() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " String s=\"Hello\";\n" +
+ " record y= (record)s; \n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " record y= (record)s; \n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " record y= (record)s; \n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_051() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " String s=\"Hello\";\n" +
+ " if (s instanceof record) { \n" +
+ " System.out.println(1);\n" +
+ " }\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (s instanceof record) { \n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+public void testBug564672_052() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "import java.util.Arrays;\n" +
+ "import java.util.List;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " List<String> messages = Arrays.asList(\"hello\", \"java\", \"testers!\");\n" +
+ " messages.forEach(record::length);\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " messages.forEach(record::length);\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved\n" +
+ "----------\n");
+}
+public void testBug564672_053() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "import java.util.Arrays;\n" +
+ "import java.util.List;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " List<String> messages = Arrays.asList(\"hello\", \"java\", \"testers!\");\n" +
+ " messages.stream().map(record::new).toArray(record[]::new);\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " messages.stream().map(record::new).toArray(record[]::new);\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 7)\n" +
+ " messages.stream().map(record::new).toArray(record[]::new);\n" +
+ " ^^^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_001() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class X extends record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "class record {}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_002() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_003() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class X implements record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"+
+ "interface record {}\n;"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_004() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements record {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " class X implements record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_005() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ " class record {}\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_006() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_007() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_008() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_009() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Y extends record {\n"+
+ "}\n" +
+ "interface record {}\n" +
+ "class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_010() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface Y extends record {\n"+
+ "}\n" +
+ "class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_011() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_012() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_013() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Z {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ " class record {}\n" +
+ "}\n" +
+ "class X {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_014() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " class Y extends record {\n"+
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " class Y extends record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_015() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Z {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ "}\n" +
+ "class X {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_016() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " class Y implements record {\n"+
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " class Y implements record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_017() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Z {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ " interface record {}\n" +
+ "}\n" +
+ "class X {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_018() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X {\n"+
+ " interface Y extends record {\n"+
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " interface Y extends record {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_019() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static record a(int i, int j) {\n" +
+ " record r=new record(i,j);\n" +
+ " return r;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " static record a(int i, int j) {\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " static record a(int i, int j) {\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 3)\n" +
+ " record r=new record(i,j);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 3)\n" +
+ " record r=new record(i,j);\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n" +
+ "5. WARNING in X.java (at line 3)\n" +
+ " record r=new record(i,j);\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 3)\n" +
+ " record r=new record(i,j);\n" +
+ " ^^^^^^\n" +
+ "record cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_020() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " class record {}\n" +
+ "\n" +
+ " static record a(int i, int j) {\n" +
+ " record r = new X().new record();\n" +
+ " return r;\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_021() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " X() throws record {} \n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record extends Exception {\n" +
+ " private static final long serialVersionUID = 1L;\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_022() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Y {\n" +
+ " int a() throws record;\n" +
+ "}\n" +
+ "\n" +
+ "class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record extends Exception {\n" +
+ " private static final long serialVersionUID = 1L;\n" +
"}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_023() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.ArrayList;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " List<record> R = new ArrayList<record>();\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record{}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_024() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface I<S> {\n" +
+ " void print(S arg);\n" +
+ "}\n" +
+ "\n" +
+ "public class X implements I<record> {\n" +
+ " public void print(record arg) {\n" +
+ " System.out.println(arg);\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_025() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Y<record> {\n" +
+ " void equal(record R) {}\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_026() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Y<record> {\n" +
+ " Y(record R) {}\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_027() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static record i;\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_028() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface I {\n" +
+ " record i = new record(0);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {\n" +
+ " int i;\n" +
+ " record (int i) {\n" +
+ " this.i=i;\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_029() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static int sum(record i, int param) {\n" +
+ " return 1;\n" +
+ " }\n" +
+ "\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record{}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_030() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " X(record i, int param){\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record{}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_031() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface I {\n" +
+ " int sum(record i, int num);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record{}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_032() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Greetings {\n" +
+ " void greet(String head, String tail);\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " Greetings g = (record, y) -> {\n" +
+ " System.out.println(record + y);\n" +
+ " };\n" +
+ " g.greet(\"Hello, \", \"World!\");\n" +
+ " }\n" +
+ "}\n",
},
- "10");
+ "Hello, World!",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_033() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record {\n" +
+ " int sum(record this, int i, int num) {\n" +
+ " return 0;\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_034() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static Rec record;\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class Rec {}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_035() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.ArrayList;\n" +
+ "import java.util.Iterator;\n" +
+ "import java.util.List;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " int rec[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };\n" +
+ " String s=\"\";\n" +
+ " List <record> recList= new ArrayList<>();\n" +
+ " for (int i:rec) {\n" +
+ " recList.add(new record(i));\n" +
+ " }\n" +
+ " for (Iterator<record> i =recList.iterator(); i.hasNext();) {\n" +
+ " s=s+i.next()+\" \";\n" +
+ " }\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record {\n" +
+ " int i;\n" +
+ " record (int i) {\n" +
+ " this.i=i;\n" +
+ " }\n" +
+ " public String toString (){\n" +
+ " return Integer.toString(i);\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_036() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.ArrayList;\n" +
+ "import java.util.List;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " int rec[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };\n" +
+ " String s=\"\";\n" +
+ " List <record> recList= new ArrayList<>();\n" +
+ " for (int i:rec) {\n" +
+ " recList.add(new record(i));\n" +
+ " }\n" +
+ " for (record i : recList) {\n" +
+ " s=s+i+\" \";\n" +
+ " }\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record {\n" +
+ " int i;\n" +
+ " record (int i) {\n" +
+ " this.i=i;\n" +
+ " }\n" +
+ " public String toString (){\n" +
+ " return Integer.toString(i);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_037() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " try (record i = new record (0)){\n" +
+ " } catch (Exception e) {\n" +
+ " e.printStackTrace();\n" +
+ " }\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record implements AutoCloseable{\n" +
+ " int i;\n" +
+ " record (int i) {\n" +
+ " this.i=i;\n" +
+ " }\n" +
+ " @Override\n" +
+ " public void close() throws Exception {}\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_038() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " try {\n" +
+ " throw new record();\n" +
+ " } catch (record e) {\n" +
+ " System.out.println(\"0\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record extends Exception {\n" +
+ " private static final long serialVersionUID = 1L;\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_039() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record Point(record x, int i) { }\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " record Point(record x, int i) { }\n" +
+ " ^^^^^^\n" +
+ "Records is a preview feature and disabled by default. Use --enable-preview to enable\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 7)\n" +
+ " class record {}\n" +
+ " ^^^^^^\n" +
+ "\'record\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_040() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Point {\n" +
+ " <T> Point(T i) {\n" +
+ " }\n" +
+ " Point (int i, int j) {\n" +
+ " <record> this(null);\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_041() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Point {\n" +
+ " <T> Point(T i) {\n" +
+ " }\n" +
+ "}\n" +
+ "class PointEx extends Point {\n" +
+ " PointEx (int i, int j) {\n" +
+ " <record> super(null);\n" +
+ " }\n;" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_042() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Y {\n" +
+ " <T> void m1() {} \n" +
+ " void m2() {\n" +
+ " this.<record>m1();" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_043() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Y{\n" +
+ " <T> Y() {}\n" +
+ " void a() {\n" +
+ " System.out.println(\"1\");\n" +
+ " }\n" +
+ "}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " new <record>Y().a();\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "1",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_044() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "interface Y{\n" +
+ "}\n" +
+ "\n" +
+ "class Z implements Y {\n" +
+ " <T> Z() {\n" +
+ " \n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " new <record>Z() {\n" +
+ " void a() {\n" +
+ " System.out.println(\"1\");\n" +
+ " }\n" +
+ " }.a();\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "1",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_045() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "class Y{" +
+ " <T> Y() {\n" +
+ " }" +
+ "}\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " new <record>Y() {\n" +
+ " void a() {\n" +
+ " System.out.println(\"1\");\n" +
+ " }\n" +
+ " }.a();\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}"
+ },
+ "1",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_046() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " record[] y= new record[3]; \n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}" +
+ "class record {}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_047() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " StrRec s = new StrRec(\"Hello\");\n" +
+ " record y = (record) s;\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class record {\n" +
+ "}\n" +
+ "\n" +
+ "class StrRec extends record {\n" +
+ " String s;\n" +
+ "\n" +
+ " StrRec(String s) {\n" +
+ " this.s = s;\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_048() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " StrRec s=new StrRec(\"Hello\");\n" +
+ " if (s instanceof record) { \n" +
+ " System.out.println(1);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "class record {}\n" +
+ "\n" +
+ "class StrRec extends record {\n" +
+ " String s;\n" +
+ "\n" +
+ " StrRec(String s) {\n" +
+ " this.s = s;\n" +
+ " }\n" +
+ "}"
+ },
+ "1",
+ options
+ );
}
-public void testBug565830_01() {
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public void testBug564672b_049() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.util.Arrays;\n" +
+ "import java.util.List;\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " List<String> messages = Arrays.asList(\"hello\", \"java\", \"testers!\");\n" +
+ " \n" +
+ " messages.stream().map(record::new).toArray(record[]::new);;\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}\n" +
+ "class record {\n" +
+ " String s;\n" +
+ "\n" +
+ " record(String s) {\n" +
+ " this.s = s;\n" +
+ " }\n" +
+ "}"
+ },
+ "0",
+ options
+ );
+}
+public void testBug565388_001() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public non-sealed record X() {}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public non-sealed record X() {}\n" +
+ " ^\n" +
+ "Illegal modifier for the record X; only public, final and strictfp are permitted\n" +
+ "----------\n"
+ );
+}
+public void testBug565388_002() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed record X() {}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed record X() {}\n" +
+ " ^\n" +
+ "Illegal modifier for the record X; only public, final and strictfp are permitted\n" +
+ "----------\n"
+ );
+}
+public void testBug565786_001() throws IOException, ClassFormatException {
runConformTest(
new String[] {
"X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}\n"+
+ "interface I {\n"+
+ " record R() {}\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ " // Method descriptor #6 ()V\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public I$R();\n";
+ verifyClassFile(expectedOutput, "I$R.class", ClassFileBytesDisassembler.SYSTEM);
+}
+// Test that without an explicit canonical constructor, we
+// report the warning on the record type.
+public void testBug563182_01() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " ^^^^\n" +
+ "Type safety: Potential heap pollution via varargs parameter args\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+//Test that in presence of an explicit canonical constructor that is NOT annotated with @SafeVarargs,
+// we don't report the warning on the record type but report on the explicit canonical constructor
+public void testBug563182_02() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " Point(T ... args) { // 2\n" +
+ " this.args = args;\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " Point(T ... args) { // 2\n" +
+ " ^^^^\n" +
+ "Type safety: Potential heap pollution via varargs parameter args\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+//Test that in presence of an explicit canonical constructor that IS annotated with @SafeVarargs,
+//we don't report the warning on neither the record type nor the explicit canonical constructor
+public void testBug563182_03() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " @SafeVarargs\n" +
+ " Point(T ... args) { // 2\n" +
+ " this.args = args;\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+//Test that in presence of a compact canonical constructor that is NOT annotated with @SafeVarargs,
+//we don't report the warning on the compact canonical constructor but report on the record type
+public void testBug563182_04() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " Point { // 2\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " ^^^^\n" +
+ "Type safety: Potential heap pollution via varargs parameter args\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+//Test that in presence of a compact canonical constructor that IS annotated with @SafeVarargs,
+//we don't report the warning on neither the record type nor the compact canonical constructor
+public void testBug563182_05() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " @SafeVarargs\n" +
+ " Point { // 2\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+//Test that in presence of a non-canonical constructor that is annotated with @SafeVarargs,
+//we don't report the warning on the non-canonical constructor but report on the record type
+public void testBug563182_06() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " @SafeVarargs\n" +
+ " Point (String s, T ... t) {\n" +
+ " this(t);\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " ^^^^\n" +
+ "Type safety: Potential heap pollution via varargs parameter args\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+//Test that in presence of a non-canonical constructor that is NOT annotated with @SafeVarargs,
+//we don't report the warning on the non-canonical constructor but report on the record type
+public void testBug563182_07() {
+ Map<String, String> customOptions = getCompilerOptions();
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<T> {\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " Point (String s, T ... t) {\n" +
+ " this(t);\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " record Point<T> (T ... args) { // 1\n" +
+ " ^^^^\n" +
+ "Type safety: Potential heap pollution via varargs parameter args\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " Point (String s, T ... t) {\n" +
+ " ^\n" +
+ "Type safety: Potential heap pollution via varargs parameter t\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ customOptions);
+}
+ public void testBug563186_01() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record Point(int myInt){\n"+
+ " @Override\n" +
+ " public int myInt(){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}\n"
+ },
+ "0");
+ }
+ public void testBug563186_02() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record Point(int myInt){\n"+
+ " public int myInt(){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}\n"
+ },
+ "0");
+ }
+ public void testBug563186_03() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record Point(int myInt){\n"+
+ " @Override\n" +
+ " public int myInt(int i){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " private record Point(int myInt){\n" +
+ " ^^^^^\n" +
+ "The type X.Point is never used locally\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " public int myInt(int i){\n" +
+ " ^^^^^^^^^^^^\n" +
+ "The method myInt(int) of type X.Point must override or implement a supertype method\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ getCompilerOptions());
+ }
+ public void testBug563186_04() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private record Point(int myInt){\n"+
+ " public int myInt(int i){\n"+
+ " return this.myInt;\n" +
+ " }\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}\n"
+ },
+ "0");
+ }
+ public void testBug565732_01() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X {\n" +
+ "} "
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public record X {\n" +
+ " ^\n" +
+ "Syntax error, insert \"RecordHeader\" to complete RecordHeaderPart\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ getCompilerOptions());
+ }
+ public void testBug565732_02() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public record X<T> {\n" +
+ "} "
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public record X<T> {\n" +
+ " ^\n" +
+ "Syntax error, insert \"RecordHeader\" to complete RecordHeaderPart\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ getCompilerOptions());
+ }
+ // Test that a record without any record components was indeed compiled
+ // to be a record at runtime
+ public void testBug565732_03() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public record X() {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(X.class.getSuperclass().getName());\n" +
+ " }\n" +
+ "}"
+ },
+ "java.lang.Record");
+ }
+ // Test that a record without any record components was indeed compiled
+ // to be a record at runtime
+ public void testBug565732_04() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public record X<T>() {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(X.class.getSuperclass().getName());\n" +
+ " }\n" +
+ "}"
+ },
+ "java.lang.Record");
+ }
+ // Test that a "record" can be used as a method name and invoked inside a record
+ public void testBug565732_05() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public record X<T>() {\n" +
+ " public static void main(String[] args) {\n" +
+ " record();\n" +
+ " }\n" +
+ " public static void record() {\n" +
+ " System.out.println(\"record()\");\n" +
+ " }\n" +
+ "}"
+ },
+ "record()");
+ }
+ // Test that a "record" can be used as a label and invoked inside a record
+ public void testBug565732_06() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public record X<T>() {\n" +
+ " public static void main(String[] args) {\n" +
+ " boolean flag = true;\n" +
+ " record: {\n" +
+ " if (flag) {\n" +
+ " System.out.println(\"record:\");\n" +
+ " flag = false;\n" +
+ " break record;\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}"
+ },
+ "record:");
+ }
+ public void testBug565732_07() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " record R {};\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " record R {};\n" +
+ " ^\n" +
+ "Syntax error, insert \"RecordHeader\" to complete RecordHeaderPart\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ getCompilerOptions());
+ }
+ public void testBug565732_08() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(R.class.getSuperclass().getName());\n" +
+ " }\n" +
+ " record R() {};\n" +
+ "}"
+ },
+ "java.lang.Record");
+ }
+ public void testBug565830_01() {
+ runConformTest(
+ new String[] {
+ "X.java",
"class X {\n"+
" void bar() throws Exception {\n"+
" record Bar(int x) implements java.io.Serializable {\n"+
@@ -3921,6 +7616,151 @@ public void testBug565830_01() {
"}",
},
"private final int X$1Bar.x");
+ }
+public void testBug566063_001() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void bar() throws Exception {\n"+
+ " enum E {\n"+
+ " ONE,\n"+
+ " TWO\n"+
+ " }\n"+
+ " interface I {}\n"+
+ " record Bar(E x) implements I{}\n"+
+ " E e = new Bar(E.ONE).x();\n"+
+ " System.out.println(e);\n"+
+ " }\n"+
+ " public static void main(String[] args) throws Exception {\n"+
+ " new X().bar();\n"+
+ " }\n"+
+ "}"
+ },
+ "ONE");
+}
+public void testBug566063_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void bar() throws Exception {\n"+
+ " static enum E {\n"+
+ " ONE,\n"+
+ " TWO\n"+
+ " }\n"+
+ " interface I {}\n"+
+ " record Bar(E x) implements I{}\n"+
+ " E e = new Bar(E.ONE).x();\n"+
+ " System.out.println(e);\n"+
+ " }\n"+
+ " public static void main(String[] args) throws Exception {\n"+
+ " new X().bar();\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " static enum E {\n" +
+ " ^\n" +
+ "A local interface, enum or record E is implicitly static; cannot have explicit static declaration\n" +
+ "----------\n");
+}
+public void testBug566063_003() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void bar() throws Exception {\n"+
+ " static enum E {\n"+
+ " ONE,\n"+
+ " TWO\n"+
+ " }\n"+
+ " interface I {}\n"+
+ " static record Bar(E x) implements I{}\n"+
+ " E e = new Bar(E.ONE).x();\n"+
+ " System.out.println(e);\n"+
+ " }\n"+
+ " public static void main(String[] args) throws Exception {\n"+
+ " new X().bar();\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " static enum E {\n" +
+ " ^\n" +
+ "A local interface, enum or record E is implicitly static; cannot have explicit static declaration\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 8)\n" +
+ " static record Bar(E x) implements I{}\n" +
+ " ^^^\n" +
+ "A local interface, enum or record Bar is implicitly static; cannot have explicit static declaration\n" +
+ "----------\n");
+}
+public void testBug566063_004() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void bar() throws Exception {\n"+
+ " enum E {\n"+
+ " ONE,\n"+
+ " TWO\n"+
+ " }\n"+
+ " static interface I {}\n"+
+ " record Bar(E x) implements I{}\n"+
+ " E e = new Bar(E.ONE).x();\n"+
+ " System.out.println(e);\n"+
+ " }\n"+
+ " public static void main(String[] args) throws Exception {\n"+
+ " new X().bar();\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " static interface I {}\n" +
+ " ^\n" +
+ "Illegal modifier for the local interface I; abstract and strictfp are the only modifiers allowed explicitly \n" +
+ "----------\n");
+}
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public void testBug566418_001() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " static void foo() {\n"+
+ " record R() {\n"+
+ " static int create(int lo) {\n"+
+ " return lo;\n"+
+ " }\n"+
+ " }\n"+
+ " System.out.println(R.create(0));\n"+
+ " }\n"+
+ " Zork();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 10)\n" +
+ " Zork();\n" +
+ " ^^^^^^\n" +
+ "Return type for the method is missing\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 10)\n" +
+ " Zork();\n" +
+ " ^^^^^^\n" +
+ "This method requires a body instead of a semicolon\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
}
public void testBug565787_01() {
runConformTest(
@@ -3939,4 +7779,103 @@ public void testBug565787_01() {
},
"");
}
+public void testBug566554_01() {
+ runConformTest(
+ new String[] {
+ "Main.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class Main {\n" +
+ " public static void main(String[] args) {\n" +
+ " final Margin margins = new Margin(0);\n" +
+ " System.out.println(margins.left()); \n" +
+ " }\n" +
+ "}\n" +
+ "record Margin(int left) {\n" +
+ " public Margin left(int value) {\n" +
+ " return new Margin(value);\n" +
+ " }\n" +
+ " public String toString() {\n" +
+ " return \"Margin[left=\" + this.left + \"]\";\n" +
+ " }\n" +
+ "}",
+ },
+ "0");
+}
+public void testBug566554_02() {
+ runConformTest(
+ new String[] {
+ "Main.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class Main {\n" +
+ " public static void main(String[] args) {\n" +
+ " final Margin margins = new Margin(0);\n" +
+ " System.out.println(margins.left()); \n" +
+ " }\n" +
+ "}\n" +
+ "record Margin(int left) {\n" +
+ " public Margin left(int value) {\n" +
+ " return new Margin(value);\n" +
+ " }\n" +
+ " public int left() {\n" +
+ " return this.left;\n" +
+ " }\n" +
+ " public String toString() {\n" +
+ " return \"Margin[left=\" + this.left + \"]\";\n" +
+ " }\n" +
+ "}",
+ },
+ "0");
+}
+public void testBug566554_03() {
+ runConformTest(
+ new String[] {
+ "Main.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class Main {\n" +
+ " public static void main(String[] args) {\n" +
+ " final Margin margins = new Margin(0);\n" +
+ " System.out.println(margins.left(0)); \n" +
+ " }\n" +
+ "}\n" +
+ "record Margin(int left) {\n" +
+ " public Margin left(int value) {\n" +
+ " return new Margin(value);\n" +
+ " }\n" +
+ " public int left() {\n" +
+ " return this.left;\n" +
+ " }\n" +
+ " public String toString() {\n" +
+ " return \"Margin[left=\" + this.left + \"]\";\n" +
+ " }\n" +
+ "}",
+ },
+ "Margin[left=0]");
+}
+public void testBug566554_04() {
+ runNegativeTest(
+ new String[] {
+ "Main.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class Main {\n" +
+ " public static void main(String[] args) {\n" +
+ " final Margin margins = new Margin(0);\n" +
+ " int l = margins.left(0); \n" +
+ " }\n" +
+ "}\n" +
+ "record Margin(int left) {\n" +
+ " public Margin left(int value) {\n" +
+ " return new Margin(value);\n" +
+ " }\n" +
+ " public int left() {\n" +
+ " return this.left;\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in Main.java (at line 5)\n" +
+ " int l = margins.left(0); \n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "Type mismatch: cannot convert from Margin to int\n" +
+ "----------\n");
+}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
index 71a25a3f03..52618d10e0 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2019 GK Software SE and others.
+ * Copyright (c) 2011, 2020 GK Software SE and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -5617,7 +5617,7 @@ public void testBug542707_001() {
options);
}
public void testBug542707_002() {
- if (this.complianceLevel < ClassFileConstants.JDK14) return; // uses switch expression
+ if (this.complianceLevel < ClassFileConstants.JDK15) return; // uses switch expression
Map options = getCompilerOptions();
options.put(JavaCore.COMPILER_PB_UNCLOSED_CLOSEABLE, CompilerOptions.ERROR);
options.put(JavaCore.COMPILER_PB_POTENTIALLY_UNCLOSED_CLOSEABLE, CompilerOptions.ERROR);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java
new file mode 100644
index 0000000000..809d744db6
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java
@@ -0,0 +1,5308 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.ToolFactory;
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+import junit.framework.Test;
+
+public class SealedTypes15Tests extends AbstractRegressionTest9 {
+
+ static {
+// TESTS_NUMBERS = new int [] { 40 };
+// TESTS_RANGE = new int[] { 1, -1 };
+// TESTS_NAMES = new String[] { "testBug565847_001"};
+ }
+
+ public static Class<?> testClass() {
+ return SealedTypes15Tests.class;
+ }
+ public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
+ }
+ public SealedTypes15Tests(String testName){
+ super(testName);
+ }
+
+ // Enables the tests to run individually
+ protected Map<String, String> getCompilerOptions() {
+ Map<String, String> defaultOptions = super.getCompilerOptions();
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15); // FIXME
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
+ defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
+ defaultOptions.put(CompilerOptions.OPTION_Store_Annotations, CompilerOptions.ENABLED);
+ return defaultOptions;
+ }
+
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput) {
+ runConformTest(testFiles, expectedOutput, getCompilerOptions());
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput, Map customOptions) {
+ Runner runner = new Runner();
+ runner.testFiles = testFiles;
+ runner.expectedOutputString = expectedOutput;
+ runner.vmArguments = new String[] {"--enable-preview"};
+ runner.customOptions = customOptions;
+ runner.javacTestOptions = JavacTestOptions.forReleaseWithPreview("15");
+ runner.runConformTest();
+ }
+ @Override
+ protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
+ runNegativeTest(testFiles, expectedCompilerLog, JavacTestOptions.forReleaseWithPreview("15"));
+ }
+ protected void runWarningTest(String[] testFiles, String expectedCompilerLog) {
+ runWarningTest(testFiles, expectedCompilerLog, null);
+ }
+ protected void runWarningTest(String[] testFiles, String expectedCompilerLog, Map<String, String> customOptions) {
+ runWarningTest(testFiles, expectedCompilerLog, customOptions, null);
+ }
+ protected void runWarningTest(String[] testFiles, String expectedCompilerLog,
+ Map<String, String> customOptions, String javacAdditionalTestOptions) {
+
+ Runner runner = new Runner();
+ runner.testFiles = testFiles;
+ runner.expectedCompilerLog = expectedCompilerLog;
+ runner.customOptions = customOptions;
+ runner.vmArguments = new String[] {"--enable-preview"};
+ runner.javacTestOptions = javacAdditionalTestOptions == null ? JavacTestOptions.forReleaseWithPreview("15") :
+ JavacTestOptions.forReleaseWithPreview("15", javacAdditionalTestOptions);
+ runner.runWarningTest();
+ }
+
+ private static void verifyClassFile(String expectedOutput, String classFileName, int mode)
+ throws IOException, ClassFormatException {
+ File f = new File(OUTPUT_DIR + File.separator + classFileName);
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String result = disassembler.disassemble(classFileBytes, "\n", mode);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ System.out.println("...");
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ }
+
+ public void testBug563430_001() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed class Y permits X{}\n" +
+ "non-sealed class X extends Y {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n",
+ },
+ "0");
+ }
+ public void testBug563430_001a() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "non-sealed class X extends Y {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n",
+ "Y.java",
+ "sealed class Y permits X{}\n",
+ },
+ "0");
+ }
+ public void testBug563430_002() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I extends SI{}\n"+
+ "non-sealed class X implements SI{\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "sealed interface SI permits X, I{}\n" +
+ "non-sealed interface I2 extends I{}\n"
+ },
+ "0");
+ }
+ public void testBug562715_001() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed class X permits Y {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n" +
+ "non-sealed class Y extends X {\n"+
+ "}\n"
+ },
+ "100");
+ }
+ public void testBug562715_002() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public sealed class X {\n"+
+ " public static void main(String[] args){\n"+
+ " int sealed = 100;\n" +
+ " System.out.println(sealed);\n" +
+ " }\n"+
+ "}\n" +
+ "non-sealed class Y extends X {\n"+
+ "}\n"
+ },
+ "100");
+ }
+ public void testBug562715_003() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed public class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n" +
+ "non-sealed class Y extends X {\n"+
+ "}\n"
+ },
+ "100");
+ }
+ public void testBug562715_004() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I {}\n"+
+ "sealed public class X<T> {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n" +
+ "non-sealed class Y<T> extends X<T> {\n"+
+ "}\n" +
+ "non-sealed interface I2 extends I {}\n"
+ },
+ "100");
+ }
+ public void testBug562715_004a() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed public class X<T> {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n" +
+ "non-sealed class Y extends X {\n"+
+ "}\n"
+ },
+ "100");
+ }
+ public void testBug562715_005() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "sealed public sealed class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " sealed public sealed class X {\n" +
+ " ^\n" +
+ "Duplicate modifier for the type X\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " sealed public sealed class X {\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares X as its direct superclass\n" +
+ "----------\n");
+ }
+ public void testBug562715_006() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X {\n"+
+ " public static sealed void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed class X {\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares X as its direct superclass\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public static sealed void main(String[] args){\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"sealed\", static expected\n" +
+ "----------\n");
+ }
+ public void testBug562715_007() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed @MyAnnot public class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n" +
+ "@interface MyAnnot {}\n" +
+ "non-sealed class Y extends X{}"
+ },
+ "100");
+ }
+ public void testBug562715_008() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed class X permits Y {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n"+
+ "sealed class Y extends X {}\n" +
+ "final class Z extends Y {}\n"
+ },
+ "100");
+ }
+ public void testBug562715_009() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed class X permits Y,Z {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n"+
+ "sealed class Y extends X {}\n" +
+ "final class Z extends X {}\n" +
+ "final class Y2 extends Y {}\n"
+ },
+ "100");
+ }
+ public void testBug562715_010() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits {\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares X as its direct superclass\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"permits\", { expected\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits {\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete Block\n" +
+ "----------\n");
+ }
+ // TODO : Enable after error flag code implemented
+ public void _testBug562715_011() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "sealed enum Natural {ONE, TWO}\n"+
+ "public sealed class X {\n"+
+ " public static sealed void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " EXPECTED ERROR IN RECORD\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"sealed\", static expected\n" +
+ "----------\n");
+ }
+ public void _testBug562715_xxx() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "sealed record R() {}\n"+
+ "public sealed class X {\n"+
+ " public static sealed void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " EXPECTED ERROR IN RECORD\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"sealed\", static expected\n" +
+ "----------\n");
+ }
+ public void testBug563806_001() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits Y, Z{\n"+
+ "}\n"+
+ "class Y {}\n"+
+ "class Z {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits Y, Z{\n" +
+ " ^\n" +
+ "Permitted class Y does not declare X as direct super class\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits Y, Z{\n" +
+ " ^\n" +
+ "Permitted class Z does not declare X as direct super class\n" +
+ "----------\n");
+ }
+ public void testBug563806_002() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits Y{\n"+
+ "}\n"+
+ "class Y {}\n"+
+ "class Z extends X{}",
+ "p1/A.java",
+ "package p1;\n"+
+ "public sealed class A extends X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed class X permits Y{\n" +
+ " ^\n" +
+ "Permitted class Y does not declare p1.X as direct super class\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 5)\n" +
+ " class Z extends X{}\n" +
+ " ^\n" +
+ "The class Z with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n" +
+ "3. ERROR in p1\\X.java (at line 5)\n" +
+ " class Z extends X{}\n" +
+ " ^\n" +
+ "The type Z extending a sealed class X should be a permitted subtype of X\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in p1\\A.java (at line 2)\n" +
+ " public sealed class A extends X{}\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares A as its direct superclass\n" +
+ "----------\n" +
+ "2. ERROR in p1\\A.java (at line 2)\n" +
+ " public sealed class A extends X{}\n" +
+ " ^\n" +
+ "The type A extending a sealed class X should be a permitted subtype of X\n" +
+ "----------\n");
+ }
+ public void testBug563806_003() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed interface X permits Y, Z{\n"+
+ "}\n"+
+ "class Y implements X{}\n"+
+ "class Z {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed interface X permits Y, Z{\n" +
+ " ^\n" +
+ "Permitted type Z does not declare X as direct super interface \n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " class Y implements X{}\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug563806_004() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, Z, Q{\n"+
+ "}\n"+
+ "class Y implements X{}\n" +
+ "interface Z {}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, Z, Q{\n" +
+ " ^\n" +
+ "Permitted type Z does not declare p1.X as direct super interface \n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, Z, Q{\n" +
+ " ^\n" +
+ "Q cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in p1\\X.java (at line 4)\n" +
+ " class Y implements X{}\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug563806_005() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits Y, Y{\n"+
+ "}\n"+
+ "class Y extends X {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits Y, Y{\n" +
+ " ^\n" +
+ "Duplicate type Y for the type X in the permits clause\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " class Y extends X {}\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug563806_006() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits Y, p1.Y{\n"+
+ "}\n"+
+ "class Y extends X {}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed class X permits Y, p1.Y{\n" +
+ " ^^^^\n" +
+ "Duplicate type Y for the type X in the permits clause\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 4)\n" +
+ " class Y extends X {}\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug563806_007() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ "}\n"+
+ "non-sealed class Y extends X {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " non-sealed class Y extends X {}\n" +
+ " ^\n" +
+ "A class Y declared as non-sealed should have either a sealed direct superclass or a sealed direct superinterface\n" +
+ "----------\n");
+ }
+ public void testBug563806_008() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y {\n"+
+ "}\n"+
+ "class Y implements X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "non-sealed public interface Y {}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 4)\n" +
+ " class Y implements X{}\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in p2\\Y.java (at line 2)\n" +
+ " non-sealed public interface Y {}\n" +
+ " ^\n" +
+ "An interface Y declared as non-sealed should have a sealed direct superinterface\n" +
+ "----------\n");
+ }
+ public void testBug563806_009() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public sealed class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(100);\n" +
+ " }\n"+
+ "}\n"+
+ "final class Y extends X {}",
+ },
+ "100");
+ }
+ public void testBug563806_010() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits Y {\n"+
+ "}\n"+
+ "final class Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y extends p1.X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p2\\Y.java (at line 2)\n" +
+ " public final class Y extends p1.X{}\n" +
+ " ^^^^\n" +
+ "The type Y extending a sealed class X should be a permitted subtype of X\n" +
+ "----------\n");
+ }
+ public void testBug563806_011() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) { \n" +
+ " System.out.println(\"0\");\n" +
+ " }\n" +
+ "}\n" +
+ "sealed interface Y {\n"+
+ "}\n"+
+ "final class Z implements Y {}",
+ },
+ "0");
+ }
+ public void testBug563806_012() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y {\n"+
+ "}\n"+
+ "final class Y implements X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y implements p1.X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p2\\Y.java (at line 2)\n" +
+ " public final class Y implements p1.X{}\n" +
+ " ^^^^\n" +
+ "The type Y extending a sealed class X should be a permitted subtype of X\n" +
+ "----------\n");
+ }
+ public void testBug563806_013() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed interface X {\n"+
+ "}\n"+
+ "interface Y extends X {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " interface Y extends X {}\n" +
+ " ^\n" +
+ "The interface Y with a sealed direct superinterface X should be declared either sealed or non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug563806_014() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y {\n"+
+ "}\n"+
+ "interface Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public interface Y extends p1.X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 4)\n" +
+ " interface Y extends X{}\n" +
+ " ^\n" +
+ "The interface Y with a sealed direct superinterface X should be declared either sealed or non-sealed\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in p2\\Y.java (at line 2)\n" +
+ " public interface Y extends p1.X{}\n" +
+ " ^\n" +
+ "The interface Y with a sealed direct superinterface X should be declared either sealed or non-sealed\n" +
+ "----------\n" +
+ "2. ERROR in p2\\Y.java (at line 2)\n" +
+ " public interface Y extends p1.X{}\n" +
+ " ^^^^\n" +
+ "The type Y extending a sealed interface X should be a permitted subtype of X\n" +
+ "----------\n");
+ }
+ public void testBug563806_015() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X permits Y{\n"+
+ "}\n"+
+ "final class Y extends X {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public class X permits Y{\n" +
+ " ^\n" +
+ "A type declaration X that has a permits clause should have a sealed modifier\n" +
+ "----------\n");
+ }
+ public void testBug563806_016() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public class X permits Y {\n"+
+ "}\n"+
+ "final class Y extends X{}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public class X permits Y {\n" +
+ " ^\n" +
+ "A type declaration X that has a permits clause should have a sealed modifier\n" +
+ "----------\n");
+ }
+ public void testBug563806_017() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public interface X permits Y{\n"+
+ "}\n"+
+ "final class Y implements X {}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public interface X permits Y{\n" +
+ " ^\n" +
+ "A type declaration X that has a permits clause should have a sealed modifier\n" +
+ "----------\n");
+ }
+ public void testBug563806_018() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public interface X permits Y {\n"+
+ "}\n"+
+ "final class Y implements X{}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public interface X permits Y {\n" +
+ " ^\n" +
+ "A type declaration X that has a permits clause should have a sealed modifier\n" +
+ "----------\n");
+ }
+ public void testBug563806_019() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits Y, p2.Y {\n"+
+ "}\n"+
+ "final class Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y extends p1.X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed class X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y in an unnamed module should be declared in the same package p1 of declaring type X\n" +
+ "----------\n");
+ }
+ public void testBug563806_020() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, p2.Y {\n"+
+ "}\n"+
+ "final class Y implements X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y implements p1.X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y in an unnamed module should be declared in the same package p1 of declaring type X\n" +
+ "----------\n");
+ }
+ public void testBug563806_021() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, p2.Y {\n"+
+ "}\n"+
+ "non-sealed interface Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public non-sealed interface Y extends p1.X{}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y in an unnamed module should be declared in the same package p1 of declaring type X\n" +
+ "----------\n");
+ }
+ public void testBug563806_022() {
+ associateToModule("mod.one", "p1/X.java");
+ associateToModule("mod.two", "p2/Y.java");
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "mod.one/module-info.java",
+ "module mod.one {\n"+
+ "requires mod.two;\n"+
+ "}\n",
+ "mod.two/module-info.java",
+ "module mod.two {\n" +
+ "exports p2;\n"+
+ "}\n",
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits Y, p2.Y {\n"+
+ "}\n"+
+ "final class Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y {}",
+ };
+ runner.expectedCompilerLog =
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed class X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y in a named module mod.one should be declared in the same module mod.one of declaring type X\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed class X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted class Y does not declare p1.X as direct super class\n" +
+ "----------\n";
+ runner.runNegativeTest();
+ }
+ public void testBug563806_023() {
+ associateToModule("mod.one", "p1/X.java");
+ associateToModule("mod.two", "p2/Y.java");
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "mod.one/module-info.java",
+ "module mod.one {\n"+
+ "requires mod.two;\n"+
+ "}\n",
+ "mod.two/module-info.java",
+ "module mod.two {\n" +
+ "exports p2;\n"+
+ "}\n",
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, p2.Y {\n"+
+ "}\n"+
+ "final class Y implements X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y {}",
+ };
+ runner.expectedCompilerLog =
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y in a named module mod.one should be declared in the same module mod.one of declaring type X\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y does not declare p1.X as direct super interface \n" +
+ "----------\n";
+ runner.runNegativeTest();
+ }
+ public void testBug563806_024() {
+ associateToModule("mod.one", "p1/X.java");
+ associateToModule("mod.two", "p2/Y.java");
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "mod.one/module-info.java",
+ "module mod.one {\n"+
+ "requires mod.two;\n"+
+ "}\n",
+ "mod.two/module-info.java",
+ "module mod.two {\n" +
+ "exports p2;\n"+
+ "}\n",
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, p2.Y {\n"+
+ "}\n"+
+ "non-sealed interface Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public interface Y {}",
+ };
+ runner.expectedCompilerLog =
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y in a named module mod.one should be declared in the same module mod.one of declaring type X\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed interface X permits Y, p2.Y {\n" +
+ " ^^^^\n" +
+ "Permitted type Y does not declare p1.X as direct super interface \n" +
+ "----------\n";
+ runner.runNegativeTest();
+ }
+ public void testBug563806_025() {
+ associateToModule("mod.one", "p1/X.java");
+ associateToModule("mod.one", "p2/Y.java");
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "mod.one/module-info.java",
+ "module mod.one {\n"+
+ "}\n",
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits Y, p2.Y {\n"+
+ "}\n"+
+ "final class Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y extends p1.X{}",
+ };
+ runner.runConformTest();
+ }
+ public void testBug563806_026() {
+ associateToModule("mod.one", "p1/X.java", "p2/Y.java");
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "mod.one/module-info.java",
+ "module mod.one {\n"+
+ "}\n",
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, p2.Y {\n"+
+ "}\n"+
+ "final class Y implements X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public final class Y implements p1.X{}",
+ };
+ runner.runConformTest();
+ }
+ public void testBug563806_027() {
+ associateToModule("mod.one", "p1/X.java");
+ associateToModule("mod.one", "p2/Y.java");
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "mod.one/module-info.java",
+ "module mod.one {\n"+
+ "}\n",
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed interface X permits Y, p2.Y {\n"+
+ "}\n"+
+ "non-sealed interface Y extends X{}\n",
+ "p2/Y.java",
+ "package p2;\n"+
+ "public non-sealed interface Y extends p1.X {}",
+ };
+ runner.runConformTest();
+ }
+ public void testBug563806_028() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public non-sealed enum X {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public non-sealed enum X {\n" +
+ " ^\n" +
+ "Illegal modifier for the enum X; only public is permitted\n" +
+ "----------\n");
+ }
+ public void testBug563806_029() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed enum X {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed enum X {\n" +
+ " ^\n" +
+ "Illegal modifier for the enum X; only public is permitted\n" +
+ "----------\n");
+ }
+ public void testBug563806_030() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public class X {\n"+
+ "static sealed enum Y {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 3)\n" +
+ " static sealed enum Y {}\n" +
+ " ^\n" +
+ "Illegal modifier for the member enum Y; only public, protected, private & static are permitted\n" +
+ "----------\n");
+ }
+ public void testBug563806_031() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public class X {\n"+
+ "static non-sealed enum Y {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 3)\n" +
+ " static non-sealed enum Y {}\n" +
+ " ^\n" +
+ "Illegal modifier for the member enum Y; only public, protected, private & static are permitted\n" +
+ "----------\n");
+ }
+ public void testBug563806_032() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed non-sealed interface X {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed non-sealed interface X {\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares X as its direct superclass\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed non-sealed interface X {\n" +
+ " ^\n" +
+ "An interface X is declared both sealed and non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug563806_033() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed @interface X {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public sealed @interface X {\n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"sealed\", static expected\n" +
+ "----------\n");
+ }
+ public void testBug563806_034() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public non-sealed @interface X {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public non-sealed @interface X {\n" +
+ " ^\n" +
+ "An interface X declared as non-sealed should have a sealed direct superinterface\n" +
+ "----------\n");
+ }
+ public void testBug563806_035() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public non-sealed interface X {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " public non-sealed interface X {\n" +
+ " ^\n" +
+ "An interface X declared as non-sealed should have a sealed direct superinterface\n" +
+ "----------\n");
+ }
+ public void testBug563806_036() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public class X {\n"+
+ " public void foo() {\n"+
+ " sealed class Y{}\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 4)\n" +
+ " sealed class Y{}\n" +
+ " ^\n" +
+ "Illegal modifier for the local class Y; only abstract or final is permitted\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 4)\n" +
+ " sealed class Y{}\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares Y as its direct superclass\n" +
+ "----------\n");
+ }
+ public void testBug563806_037() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public class X {\n"+
+ " public void foo() {\n"+
+ " non-sealed class Y{}\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 4)\n" +
+ " non-sealed class Y{}\n" +
+ " ^\n" +
+ "Illegal modifier for the local class Y; only abstract or final is permitted\n" +
+ "----------\n");
+ }
+ public void testBug563806_038() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public class X {\n"+
+ " public void foo() {\n"+
+ " non-sealed sealed class Y{}\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 4)\n" +
+ " non-sealed sealed class Y{}\n" +
+ " ^\n" +
+ "Illegal modifier for the local class Y; only abstract or final is permitted\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 4)\n" +
+ " non-sealed sealed class Y{}\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares Y as its direct superclass\n" +
+ "----------\n");
+ }
+ public void testBug563806_039() {
+ this.runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class A{}\n"+
+ "public class X {\n"+
+ " public void foo() {\n"+
+ " class Y extends A{}\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " sealed class A{}\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares A as its direct superclass\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 5)\n" +
+ " class Y extends A{}\n" +
+ " ^\n" +
+ "A local class Y cannot have a sealed direct superclass or a sealed direct superinterface A\n" +
+ "----------\n");
+ }
+ public void testBug564191_001() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X permits Y, Z{\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "final class Y extends X{}\n" +
+ "final class Z extends X{}\n",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #33 p1/Y,\n" +
+ " #35 p1/Z\n" +
+ "}";
+ verifyClassFile(expectedOutput, "p1/X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // Test that implicit permitted (top-level) types make it to the .class file
+ public void testBug564190_1() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "final class Y extends X{}\n" +
+ "final class Z extends X{}\n",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #33 p1/Y,\n" +
+ " #35 p1/Z\n" +
+ "}";
+ verifyClassFile(expectedOutput, "p1/X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // Test that implicit permitted final (member) types make it to the .class file
+ public void testBug564190_2() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ " final class Y extends X{}\n" +
+ " final class Z extends X{}\n" +
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #33 p1/X$Y,\n" +
+ " #35 p1/X$Z\n" +
+ "}";
+ verifyClassFile(expectedOutput, "p1/X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // Test that implicit permitted non-sealed (member) types make it to the .class file
+ public void testBug564190_3() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ " non-sealed class Y extends X{}\n" +
+ " non-sealed class Z extends X{}\n" +
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #33 p1/X$Y,\n" +
+ " #35 p1/X$Z\n" +
+ "}";
+ verifyClassFile(expectedOutput, "p1/X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // Test that implicit permitted member type is reported without final, sealed or non-sealed
+ public void testBug564190_4() throws IOException, ClassFormatException {
+ runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X {\n" +
+ " class Y extends X {}\n" +
+ " final class Z extends Y {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 3)\n" +
+ " class Y extends X {}\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n");
+ }
+ // Test that implicit permitted member type with implicit permitted types
+ // is reported when its permitted type doesn't extend the member type
+ public void testBug564190_5() throws IOException, ClassFormatException {
+ runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X {\n" +
+ " sealed class Y extends X {}\n" +
+ " final class Z {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 3)\n" +
+ " sealed class Y extends X {}\n" +
+ " ^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares Y as its direct superclass\n" +
+ "----------\n");
+ }
+ // Test that implicit permitted member type with explicit permits clause
+ // is reported when its permitted type doesn't extend the member type
+ public void testBug564190_6() throws IOException, ClassFormatException {
+ runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X {\n" +
+ " sealed class Y extends X permits Z {}\n" +
+ " final class Z {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 3)\n" +
+ " sealed class Y extends X permits Z {}\n" +
+ " ^\n" +
+ "Permitted class Z does not declare p1.X.Y as direct super class\n" +
+ "----------\n");
+ }
+ // Test that implicit permitted member type with explicit permits clause
+ // is reported when its permitted type doesn't extend the member type
+ public void testBug564190_7() throws IOException, ClassFormatException {
+ runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed interface SI {}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 2)\n" +
+ " sealed interface SI {}\n" +
+ " ^^\n" +
+ "Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares SI as its direct superclass\n" +
+ "----------\n");
+ }
+ public void testBug564450_001() throws IOException, ClassFormatException {
+ runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "sealed class X permits Y{\n" +
+ "}",
+ "p1/Y.java",
+ "package p1;\n"+
+ "class Y extends X {\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\Y.java (at line 2)\n" +
+ " class Y extends X {\n" +
+ " ^\n" +
+ "The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
+ "----------\n");
+ }
+ public void testBug564047_001() throws CoreException, IOException {
+ String outputDirectory = Util.getOutputDirectory();
+ String lib1Path = outputDirectory + File.separator + "lib1.jar";
+ try {
+ Util.createJar(
+ new String[] {
+ "p/Y.java",
+ "package p;\n" +
+ "public sealed class Y permits Z{}",
+ "p/Z.java",
+ "package p;\n" +
+ "public final class Z extends Y{}",
+ },
+ lib1Path,
+ JavaCore.VERSION_15,
+ true);
+ String[] libs = getDefaultClassPaths();
+ int len = libs.length;
+ System.arraycopy(libs, 0, libs = new String[len+1], 0, len);
+ libs[len] = lib1Path;
+ this.runNegativeTest(
+ new String[] {
+ "src/p/X.java",
+ "package p;\n" +
+ "public class X extends Y {\n" +
+ " public static void main(String[] args){\n" +
+ " System.out.println(0);\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in src\\p\\X.java (at line 2)\n" +
+ " public class X extends Y {\n" +
+ " ^\n" +
+ "The class X with a sealed direct superclass or a sealed direct superinterface Y should be declared either final, sealed, or non-sealed\n" +
+ "----------\n" +
+ "2. ERROR in src\\p\\X.java (at line 2)\n" +
+ " public class X extends Y {\n" +
+ " ^\n" +
+ "The type X extending a sealed class Y should be a permitted subtype of Y\n" +
+ "----------\n",
+ libs,
+ true);
+ } catch (IOException e) {
+ System.err.println("could not write to current working directory ");
+ } finally {
+ new File(lib1Path).delete();
+ }
+
+ }
+ public void testBug564492_001() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static void main(String[] args){\n"+
+ " new Y(){};\n" +
+ " }\n"+
+ "}\n"+
+ "sealed class Y{}\n"+
+ "final class Z extends Y {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new Y(){};\n" +
+ " ^\n" +
+ "An anonymous class cannot subclass a sealed type Y\n" +
+ "----------\n");
+ }
+ public void testBug564492_002() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " IY y = new IY(){};\n"+
+ " }\n"+
+ "}\n"+
+ "sealed interface I {}\n"+
+ "sealed interface IY extends I {}\n"+
+ "final class Z implements IY{}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " IY y = new IY(){};\n" +
+ " ^^\n" +
+ "A local class new IY(){} cannot have a sealed direct superclass or a sealed direct superinterface IY\n" +
+ "----------\n");
+ }
+ public void testBug564492_003() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits A.Y {\n"+
+ " public static void main(String[] args) {\n"+
+ " new A.Y() {};\n"+
+ " }\n"+
+ "}\n"+
+ " \n"+
+ "class A {\n"+
+ " static sealed class Y extends X permits Z {}\n"+
+ " final class Z extends Y{}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new A.Y() {};\n" +
+ " ^^^\n" +
+ "An anonymous class cannot subclass a sealed type A.Y\n" +
+ "----------\n");
+ }
+ public void testBug564492_004() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " new A.IY() {};\n"+
+ " }\n"+
+ "}\n"+
+ " \n"+
+ "class A {\n"+
+ " sealed interface I permits IY{}\n"+
+ " sealed interface IY extends I permits Z {}\n"+
+ " final class Z implements IY{}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new A.IY() {};\n" +
+ " ^^^^\n" +
+ "A local class new IY(){} cannot have a sealed direct superclass or a sealed direct superinterface A.IY\n" +
+ "----------\n");
+ }
+ public void testBug564498_1() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits A.Y {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "class A {\n" +
+ " sealed class Y extends X {\n" +
+ " final class SubInnerY extends Y {}\n" +
+ " } \n" +
+ " final class Z extends Y {}\n" +
+ "}",
+ },
+ "");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #24 p1/A$Y$SubInnerY,\n" +
+ " #26 p1/A$Z\n" +
+ "}";
+ verifyClassFile(expectedOutput, "p1/A$Y.class", ClassFileBytesDisassembler.SYSTEM);
+ expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #21 p1/A$Y\n";
+ verifyClassFile(expectedOutput, "p1/X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug564498_2() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits A.Y {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "class A {\n" +
+ " sealed class Y extends X {} \n" +
+ " final class Z extends Y {}\n" +
+ " final class SubY extends Y {}" +
+ "}",
+ },
+ "");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #22 p1/A$Z,\n" +
+ " #24 p1/A$SubY\n" +
+ "}";
+ verifyClassFile(expectedOutput, "p1/A$Y.class", ClassFileBytesDisassembler.SYSTEM);
+ expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #21 p1/A$Y\n";
+ verifyClassFile(expectedOutput, "p1/X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug564498_3() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits A.Y {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "class A {\n" +
+ " sealed class Y extends X {\n" +
+ " final class SubInnerY extends Y {}\n" +
+ " } \n" +
+ " final class Z extends Y {}\n" +
+ " final class SubY extends Y {}" +
+ "}",
+ },
+ "");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #24 p1/A$Y$SubInnerY,\n" +
+ " #26 p1/A$Z,\n" +
+ " #28 p1/A$SubY\n";
+ verifyClassFile(expectedOutput, "p1/A$Y.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug564498_4() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits A.Y {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "class A {\n" +
+ " sealed class Y extends X permits Y.SubInnerY {\n" +
+ " final class SubInnerY extends Y {}\n" +
+ " } \n" +
+ "}",
+ },
+ "");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #24 p1/A$Y$SubInnerY\n";
+ verifyClassFile(expectedOutput, "p1/A$Y.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ // Reject references of membertype without qualifier of enclosing type in permits clause
+ public void testBug564498_5() throws IOException, ClassFormatException {
+ runNegativeTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits A.Y {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "class A {\n" +
+ " sealed class Y extends X permits SubInnerY {\n" +
+ " final class SubInnerY extends Y {}\n" +
+ " } \n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in p1\\X.java (at line 6)\n" +
+ " sealed class Y extends X permits SubInnerY {\n" +
+ " ^^^^^^^^^\n" +
+ "SubInnerY cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in p1\\X.java (at line 7)\n" +
+ " final class SubInnerY extends Y {}\n" +
+ " ^\n" +
+ "The type SubInnerY extending a sealed class A.Y should be a permitted subtype of A.Y\n" +
+ "----------\n");
+ }
+ // accept references of membertype without qualifier of enclosing type in permits clause
+ // provided it is imported
+ public void testBug564498_6() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "p1/X.java",
+ "package p1;\n"+
+ "import p1.Y.Z;\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "sealed class Y permits Z {\n" +
+ " final class Z extends Y {}\n" +
+ "}",
+ },
+ "");
+ }
+ public void testBug564613_001() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ "\n"+
+ " public boolean permits( String s ) {\n"+
+ " return true;\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " boolean b = new X().permits(\"hello\");\n"+
+ " System.out.println(b ? \"Hello\" : \"World\");\n"+
+ " }\n"+
+ "}",
+ },
+ "Hello");
+ }
+ public void testBug564613_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits permits Y, Z {}\n"+
+ "final class Y extends X{}\n" +
+ "final class Z extends X{}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits permits Y, Z {}\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"permits\", delete this token\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_001() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class permits {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type permits\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class permits {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type permits\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_003() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " permits p;\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ "permits.java",
+ "public class permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " permits p;\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. WARNING in permits.java (at line 1)\n" +
+ " public class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_004() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " permits p;\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ "permits.java",
+ "public class permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " permits p;\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in permits.java (at line 1)\n" +
+ " public class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_005() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<permits> {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X<permits> {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X<permits>\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_006() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<permits> {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X<permits> {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X<permits>\n" +
+ "----------\n");
+ }
+ public void testBug564638_007() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends permits {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "class permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_008() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends permits {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "class permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X extends permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_009() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements permits {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X implements permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " interface permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_010() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements permits {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X implements permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " interface permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_011() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X extends permits {\n"+
+ " default void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " interface X extends permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " interface permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_012() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X extends permits {\n"+
+ " default void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface permits {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " interface X extends permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " interface permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_013() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends {\n"+
+ " permits foo() {\n" +
+ " Zork();\n" +
+ " return null;\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"extends\", Type expected after this token\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " permits foo() {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_014() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " permits foo() {\n" +
+ " Zork();\n" +
+ " return null;\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " permits foo() {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " permits foo() {\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_015() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() throws permits{\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " void foo() throws permits{\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_016() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() throws permits{\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " void foo() throws permits{\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " void foo() throws permits{\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_017() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X <T extends permits> {\n"+
+ " <T> void foo(T extends permits) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X <T extends permits> {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " class X <T extends permits> {\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete ClassBody\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 2)\n" +
+ " <T> void foo(T extends permits) {\n" +
+ " ^\n" +
+ "The type parameter T is hiding the type T\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 2)\n" +
+ " <T> void foo(T extends permits) {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"extends\", delete this token\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 5)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error on token \"}\", delete this token\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_018() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X <T extends permits>{\n"+
+ " <T> void foo(T extends permits) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X <T extends permits>{\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " class X <T extends permits>{\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 1)\n" +
+ " class X <T extends permits>{\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete ClassBody\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 2)\n" +
+ " <T> void foo(T extends permits) {\n" +
+ " ^\n" +
+ "The type parameter T is hiding the type T\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 2)\n" +
+ " <T> void foo(T extends permits) {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"extends\", delete this token\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 5)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error on token \"}\", delete this token\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_019() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "enum X {\n"+
+ " ONE(1);\n" +
+ " private final permits p;\n" +
+ " X(int p) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " private final permits p;\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_020() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "enum X {\n"+
+ " ONE(1);\n" +
+ " private final permits p;\n" +
+ " X(int p) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " private final permits p;\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " private final permits p;\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_021() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " I i = (permits p)-> {};\n" +
+// " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " void apply(Object o);\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " I i = (permits p)-> {};\n" +
+ " ^^^^^^^^^^^^^\n" +
+ "This lambda expression refers to the missing type permits\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " I i = (permits p)-> {};\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_022() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " I i = (permits p)-> {};\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " void apply(Object o);\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " I i = (permits p)-> {};\n" +
+ " ^^^^^^^^^^^^^\n" +
+ "This lambda expression refers to the missing type permits\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " I i = (permits p)-> {};\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " I i = (permits p)-> {};\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_023() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(permits this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_024() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(permits this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_025() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(permits this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_026() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(permits this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_027() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class permits {\n"+
+ " public void foo(permits this) {}\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_028() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class permits {\n"+
+ " public void foo(permits this) {}\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " public void foo(permits this) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_029() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " permits p;\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " permits p;\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_030() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " permits p;\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " permits p;\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " permits p;\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_031() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " for (permits i = 0; i < 10; ++i) {} \n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " for (permits i = 0; i < 10; ++i) {} \n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_032() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " for (permits i = 0; i < 10; ++i) {} \n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " for (permits i = 0; i < 10; ++i) {} \n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " for (permits i = 0; i < 10; ++i) {} \n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_033() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(permits[] args) {\n" +
+ " for (permits p : args) {} \n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public static void main(permits[] args) {\n" +
+ " ^^^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " for (permits p : args) {} \n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_034() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(permits[] args) {\n" +
+ " for (permits p : args) {} \n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " public static void main(permits[] args) {\n" +
+ " ^^^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public static void main(permits[] args) {\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 3)\n" +
+ " for (permits p : args) {} \n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 3)\n" +
+ " for (permits p : args) {} \n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_035() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (permits y = new Y()) {\n"+
+ " \n"+
+ " } catch (Exception e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " try (permits y = new Y()) {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_036() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (permits y = new Y()) {\n"+
+ " \n"+
+ " } catch (Exception e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " try (permits y = new Y()) {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " try (permits y = new Y()) {\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_037() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (Y y = new Y()) {\n"+
+ " \n"+
+ " } catch (permits e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " } catch (permits e) {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_038() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (Y y = new Y()) {\n"+
+ " \n"+
+ " } catch (permits e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 5)\n" +
+ " } catch (permits e) {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " } catch (permits e) {\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_039() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X(permits p) {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " record X(permits p) {\n" +
+ " ^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " record X(permits p) {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_040() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X(permits p) {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " record X(permits p) {\n" +
+ " ^^^^^^\n" +
+ "Records is a preview feature and disabled by default. Use --enable-preview to enable\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_041() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " <permits>this(t);\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " <permits>this(t);\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " <permits>this(t);\n" +
+ " ^^^^^^^^\n" +
+ "The parameterized constructor <permits>X(permits) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_042() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " <permits>this(t);\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 5)\n" +
+ " <permits>this(t);\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " <permits>this(t);\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " <permits>this(t);\n" +
+ " ^^^^^^^^\n" +
+ "The parameterized constructor <permits>X(permits) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_043() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " new <permits>X(t).foo();\n"+
+ " }\n"+
+ " public void foo() {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " new <permits>X(t).foo();\n" +
+ " ^^^^^^^^^^^^^^^^^\n" +
+ "The parameterized constructor <permits>X(permits) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " new <permits>X(t).foo();\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_044() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " new <permits>X(t).foo();\n"+
+ " }\n"+
+ " public void foo() {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " new <permits>X(t).foo();\n" +
+ " ^^^^^^^^^^^^^^^^^\n" +
+ "The parameterized constructor <permits>X(permits) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 5)\n" +
+ " new <permits>X(t).foo();\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " new <permits>X(t).foo();\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_045() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new X();\n"+
+ " x.<permits>foo(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " x.<permits>foo(0);\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " x.<permits>foo(0);\n" +
+ " ^^^\n" +
+ "The parameterized method <permits>foo(permits) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_046() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new X();\n"+
+ " x.<permits>foo(0);\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 6)\n" +
+ " x.<permits>foo(0);\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " x.<permits>foo(0);\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " x.<permits>foo(0);\n" +
+ " ^^^\n" +
+ "The parameterized method <permits>foo(permits) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_047() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new permits();\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " X x = new permits();\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_048() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new permits();\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 5)\n" +
+ " X x = new permits();\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " X x = new permits();\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_049() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " new permits() {\n"+
+ " @Override\n"+
+ " void foo() {}\n"+
+ " }.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "abstract class permits {\n"+
+ " abstract void foo();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new permits() {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " abstract class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_050() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " new permits() {\n"+
+ " @Override\n"+
+ " void foo() {\n"+
+ " Zork();\n"+
+ " }\n"+
+ " }.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "abstract class permits {\n"+
+ " abstract void foo();\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " new permits() {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type new permits(){}\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 11)\n" +
+ " abstract class permits {\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_051() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " Object[] p = new permits[10];\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " Object[] p = new permits[10];\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_052() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " Object[] p = new permits[10];\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " Object[] p = new permits[10];\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Object[] p = new permits[10];\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_053() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " new X().foo((permits) null);\n"+
+ " }\n"+
+ " private void foo(permits o) {}\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new X().foo((permits) null);\n" +
+ " ^^^\n" +
+ "The method foo(permits) from the type X refers to the missing type permits\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " new X().foo((permits) null);\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " private void foo(permits o) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_054() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " new X().foo((permits) null);\n"+
+ " }\n"+
+ " private void foo(permits o) {}\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new X().foo((permits) null);\n" +
+ " ^^^\n" +
+ "The method foo(permits) from the type X refers to the missing type permits\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " new X().foo((permits) null);\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " new X().foo((permits) null);\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 5)\n" +
+ " private void foo(permits o) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 5)\n" +
+ " private void foo(permits o) {}\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_055() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " private void foo(Object o) {\n"+
+ " if (o instanceof permits) {}\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " if (o instanceof permits) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_056() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " private void foo(Object o) {\n"+
+ " if (o instanceof permits) {}\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " if (o instanceof permits) {}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " if (o instanceof permits) {}\n" +
+ " ^^^^^^^\n" +
+ "permits cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638_057() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " @SuppressWarnings(\"unused\")\n"+
+ " I i = permits :: new;\n"+
+ " Zork();\n"+
+ " }\n"+
+ "}\n"+
+ "class permits{}\n" +
+ "interface I {\n"+
+ " Object gen();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 8)\n" +
+ " class permits{}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638_058() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " @SuppressWarnings(\"unused\")\n"+
+ " I i = permits :: new;\n"+
+ " Zork();\n"+
+ " }\n"+
+ "}\n"+
+ "class permits{}\n" +
+ "interface I {\n"+
+ " Object gen();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 8)\n" +
+ " class permits{}\n" +
+ " ^^^^^^^\n" +
+ "\'permits\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_001() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class sealed {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type sealed\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_002() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class sealed {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type sealed\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_003() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " sealed p;\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ "sealed.java",
+ "public class sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " sealed p;\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. WARNING in sealed.java (at line 1)\n" +
+ " public class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_004() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " sealed p;\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ "sealed.java",
+ "public class sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " sealed p;\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in sealed.java (at line 1)\n" +
+ " public class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_005() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<sealed> {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X<sealed> {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X<sealed>\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_006() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X<sealed> {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X<sealed> {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X<sealed>\n" +
+ "----------\n");
+ }
+ public void testBug564638b_007() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends sealed {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "class sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_008() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends sealed {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "class sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X extends sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_009() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements sealed {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X implements sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " interface sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_010() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X implements sealed {\n"+
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X implements sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " interface sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_011() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X extends sealed {\n"+
+ " default void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " interface X extends sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " interface sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_012() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "interface X extends sealed {\n"+
+ " default void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface sealed {\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " interface X extends sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 6)\n" +
+ " interface sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_013() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X extends {\n"+
+ " sealed foo() {\n" +
+ " Zork();\n" +
+ " return null;\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X extends {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"extends\", Type expected after this token\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " sealed foo() {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_014() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " sealed foo() {\n" +
+ " Zork();\n" +
+ " return null;\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " sealed foo() {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " sealed foo() {\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_015() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() throws sealed{\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " void foo() throws sealed{\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_016() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " void foo() throws sealed{\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " void foo() throws sealed{\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " void foo() throws sealed{\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_017() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X <T extends sealed> {\n"+
+ " <T> void foo(T extends sealed) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " class X <T extends sealed> {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " class X <T extends sealed> {\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete ClassBody\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 2)\n" +
+ " <T> void foo(T extends sealed) {\n" +
+ " ^\n" +
+ "The type parameter T is hiding the type T\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 2)\n" +
+ " <T> void foo(T extends sealed) {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"extends\", delete this token\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 5)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error on token \"}\", delete this token\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_018() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X <T extends sealed>{\n"+
+ " <T> void foo(T extends sealed) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " class X <T extends sealed>{\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " class X <T extends sealed>{\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 1)\n" +
+ " class X <T extends sealed>{\n" +
+ " ^\n" +
+ "Syntax error, insert \"}\" to complete ClassBody\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 2)\n" +
+ " <T> void foo(T extends sealed) {\n" +
+ " ^\n" +
+ "The type parameter T is hiding the type T\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 2)\n" +
+ " <T> void foo(T extends sealed) {\n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"extends\", delete this token\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 5)\n" +
+ " }\n" +
+ " ^\n" +
+ "Syntax error on token \"}\", delete this token\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_019() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "enum X {\n"+
+ " ONE(1);\n" +
+ " private final sealed p;\n" +
+ " X(int p) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " private final sealed p;\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_020() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "enum X {\n"+
+ " ONE(1);\n" +
+ " private final sealed p;\n" +
+ " X(int p) {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " private final sealed p;\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " private final sealed p;\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_021() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " I i = (sealed p)-> {};\n" +
+// " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " void apply(Object o);\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " I i = (sealed p)-> {};\n" +
+ " ^^^^^^^^^^^^\n" +
+ "This lambda expression refers to the missing type sealed\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " I i = (sealed p)-> {};\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_022() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " I i = (sealed p)-> {};\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}\n" +
+ "interface I {\n" +
+ " void apply(Object o);\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " I i = (sealed p)-> {};\n" +
+ " ^^^^^^^^^^^^\n" +
+ "This lambda expression refers to the missing type sealed\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " I i = (sealed p)-> {};\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " I i = (sealed p)-> {};\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_023() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(sealed this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_024() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(sealed this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_025() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(sealed this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_026() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public void foo(sealed this) {}\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_027() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class sealed {\n"+
+ " public void foo(sealed this) {}\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_028() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " class sealed {\n"+
+ " public void foo(sealed this) {}\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " public void foo(sealed this) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_029() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " sealed p;\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " sealed p;\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_030() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " sealed p;\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " sealed p;\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " sealed p;\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 4)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_031() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " for (sealed i = 0; i < 10; ++i) {} \n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " for (sealed i = 0; i < 10; ++i) {} \n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_032() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n" +
+ " for (sealed i = 0; i < 10; ++i) {} \n" +
+ " }\n" +
+ " void foo() {\n" +
+ " Zork();\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " for (sealed i = 0; i < 10; ++i) {} \n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " for (sealed i = 0; i < 10; ++i) {} \n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_033() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(sealed[] args) {\n" +
+ " for (sealed p : args) {} \n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public static void main(sealed[] args) {\n" +
+ " ^^^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " for (sealed p : args) {} \n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_034() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(sealed[] args) {\n" +
+ " for (sealed p : args) {} \n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 2)\n" +
+ " public static void main(sealed[] args) {\n" +
+ " ^^^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " public static void main(sealed[] args) {\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 3)\n" +
+ " for (sealed p : args) {} \n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 3)\n" +
+ " for (sealed p : args) {} \n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_035() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (sealed y = new Y()) {\n"+
+ " \n"+
+ " } catch (Exception e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " try (sealed y = new Y()) {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_036() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (sealed y = new Y()) {\n"+
+ " \n"+
+ " } catch (Exception e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " try (sealed y = new Y()) {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " try (sealed y = new Y()) {\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_037() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (Y y = new Y()) {\n"+
+ " \n"+
+ " } catch (sealed e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " } catch (sealed e) {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_038() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " try (Y y = new Y()) {\n"+
+ " \n"+
+ " } catch (sealed e) {\n"+
+ " e.printStackTrace();\n"+
+ " } finally {\n"+
+ " \n"+
+ " }\n"+
+ " }\n"+
+ "}\n"+
+ "class Y implements AutoCloseable {\n"+
+ " @Override\n"+
+ " public void close() throws Exception {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 5)\n" +
+ " } catch (sealed e) {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " } catch (sealed e) {\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_039() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X(sealed p) {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " record X(sealed p) {\n" +
+ " ^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 1)\n" +
+ " record X(sealed p) {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_040() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "record X(sealed p) {\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " record X(sealed p) {\n" +
+ " ^^^^^^\n" +
+ "Records is a preview feature and disabled by default. Use --enable-preview to enable\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_041() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " <sealed>this(t);\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " <sealed>this(t);\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " <sealed>this(t);\n" +
+ " ^^^^^^^^\n" +
+ "The parameterized constructor <sealed>X(sealed) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_042() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " <sealed>this(t);\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 5)\n" +
+ " <sealed>this(t);\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " <sealed>this(t);\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " <sealed>this(t);\n" +
+ " ^^^^^^^^\n" +
+ "The parameterized constructor <sealed>X(sealed) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_043() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " new <sealed>X(t).foo();\n"+
+ " }\n"+
+ " public void foo() {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " new <sealed>X(t).foo();\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The parameterized constructor <sealed>X(sealed) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " new <sealed>X(t).foo();\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_044() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> X(T t) {}\n"+
+ " \n"+
+ " public X(int t, char c) {\n"+
+ " new <sealed>X(t).foo();\n"+
+ " }\n"+
+ " public void foo() {}\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " new <sealed>X(t).foo();\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The parameterized constructor <sealed>X(sealed) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 5)\n" +
+ " new <sealed>X(t).foo();\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " new <sealed>X(t).foo();\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_045() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new X();\n"+
+ " x.<sealed>foo(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " x.<sealed>foo(0);\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " x.<sealed>foo(0);\n" +
+ " ^^^\n" +
+ "The parameterized method <sealed>foo(sealed) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_046() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new X();\n"+
+ " x.<sealed>foo(0);\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 6)\n" +
+ " x.<sealed>foo(0);\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " x.<sealed>foo(0);\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " x.<sealed>foo(0);\n" +
+ " ^^^\n" +
+ "The parameterized method <sealed>foo(sealed) of type X is not applicable for the arguments (Integer)\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_047() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new sealed();\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " X x = new sealed();\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_048() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public <T> void foo(T t) {}\n"+
+ " \n"+
+ " public X() {\n"+
+ " X x = new sealed();\n"+
+ " }\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 5)\n" +
+ " X x = new sealed();\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " X x = new sealed();\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_049() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " new sealed() {\n"+
+ " @Override\n"+
+ " void foo() {}\n"+
+ " }.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "abstract class sealed {\n"+
+ " abstract void foo();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new sealed() {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " abstract class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_050() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " new sealed() {\n"+
+ " @Override\n"+
+ " void foo() {\n"+
+ " Zork();\n"+
+ " }\n"+
+ " }.foo();\n"+
+ " }\n"+
+ "}\n"+
+ "abstract class sealed {\n"+
+ " abstract void foo();\n"+
+ "}\n",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " new sealed() {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type new sealed(){}\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 11)\n" +
+ " abstract class sealed {\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_051() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " Object[] p = new sealed[10];\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " Object[] p = new sealed[10];\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_052() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public X() {\n"+
+ " Object[] p = new sealed[10];\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " Object[] p = new sealed[10];\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " Object[] p = new sealed[10];\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_053() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " new X().foo((sealed) null);\n"+
+ " }\n"+
+ " private void foo(sealed o) {}\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new X().foo((sealed) null);\n" +
+ " ^^^\n" +
+ "The method foo(sealed) from the type X refers to the missing type sealed\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " new X().foo((sealed) null);\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " private void foo(sealed o) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_054() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " new X().foo((sealed) null);\n"+
+ " }\n"+
+ " private void foo(sealed o) {}\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " new X().foo((sealed) null);\n" +
+ " ^^^\n" +
+ "The method foo(sealed) from the type X refers to the missing type sealed\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 3)\n" +
+ " new X().foo((sealed) null);\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 3)\n" +
+ " new X().foo((sealed) null);\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 5)\n" +
+ " private void foo(sealed o) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 5)\n" +
+ " private void foo(sealed o) {}\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_055() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " private void foo(Object o) {\n"+
+ " if (o instanceof sealed) {}\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " if (o instanceof sealed) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_056() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " private void foo(Object o) {\n"+
+ " if (o instanceof sealed) {}\n"+
+ " }\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 3)\n" +
+ " if (o instanceof sealed) {}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " if (o instanceof sealed) {}\n" +
+ " ^^^^^^\n" +
+ "sealed cannot be resolved to a type\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug564638b_057() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " @SuppressWarnings(\"unused\")\n"+
+ " I i = sealed :: new;\n"+
+ " Zork();\n"+
+ " }\n"+
+ "}\n"+
+ "class sealed{}\n" +
+ "interface I {\n"+
+ " Object gen();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 8)\n" +
+ " class sealed{}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n");
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void testBug564638b_058() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " @SuppressWarnings(\"unused\")\n"+
+ " I i = sealed :: new;\n"+
+ " Zork();\n"+
+ " }\n"+
+ "}\n"+
+ "class sealed{}\n" +
+ "interface I {\n"+
+ " Object gen();\n"+
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " Zork();\n" +
+ " ^^^^\n" +
+ "The method Zork() is undefined for the type X\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 8)\n" +
+ " class sealed{}\n" +
+ " ^^^^^^\n" +
+ "\'sealed\' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java 15\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+ public void testBug565561_001() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits Outer.Inner {\n" +
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n" +
+ "class Outer{\n" +
+ " final class Inner extends X{}\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ " Inner classes:\n" +
+ " [inner class info: #33 Outer$Inner, outer class info: #36 Outer\n" +
+ " inner name: #38 Inner, accessflags: 16 final]\n" +
+ "\n" +
+ "PermittedSubclasses:\n" +
+ " #33 Outer$Inner\n" +
+ "}";
+ verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565116_001() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "permits/X.java",
+ "package permits;\n"+
+ "class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " X x = new permits.X();\n"+
+ " }\n"+
+ "}",
+ },
+ "");
+ }
+ public void testBug565638_001() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed class X {\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}\n"+
+ "final class Outer {\n"+
+ " final class Inner extends X{\n"+
+ " }\n"+
+ "}",
+ },
+ "0");
+ }
+ public void testBug565782_001() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I permits X {}\n"+
+ "enum X implements I {\n"+
+ " ONE {};\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #14 X$1\n" +
+ "}";
+ verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565782_002() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I permits X {}\n"+
+ "public enum X implements I {\n"+
+ " ONE ;\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput = "public final enum X implements I {\n";
+ verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565782_003() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I {}\n"+
+ "enum X implements I {\n"+
+ " ONE {};\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #14 X$1\n" +
+ "}";
+ verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565782_004() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I {}\n"+
+ "class X {\n"+
+ " enum E implements I {\n"+
+ " ONE {};\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #14 X$E$1\n" +
+ "}";
+ verifyClassFile(expectedOutput, "X$E.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565782_005() throws IOException, ClassFormatException {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "sealed interface I permits X {}\n"+
+ "enum X implements I {\n"+
+ " ONE {},\n"+
+ " TWO {},\n"+
+ " THREE {};\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}",
+ },
+ "0");
+ String expectedOutput =
+ "PermittedSubclasses:\n" +
+ " #16 X$1,\n" +
+ " #25 X$2,\n" +
+ " #31 X$3\n" +
+ "}";
+ verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void testBug565847_001() {
+ Map<String, String> options =getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.WARNING);
+
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public sealed class X permits Y {" +
+ "Zork();\n" +
+ "}\n" +
+ "final class Y extends X{}\n" +
+ "sealed interface I{}\n" +
+ "final class Z implements I{}",
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 1)\n" +
+ " public sealed class X permits Y {Zork();\n" +
+ " ^^^^^^\n" +
+ "You are using a preview language feature that may or may not be supported in a future release\n" +
+ "----------\n" +
+ "2. WARNING in X.java (at line 1)\n" +
+ " public sealed class X permits Y {Zork();\n" +
+ " ^^^^^^^\n" +
+ "You are using a preview language feature that may or may not be supported in a future release\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits Y {Zork();\n" +
+ " ^^^^^^\n" +
+ "Return type for the method is missing\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 1)\n" +
+ " public sealed class X permits Y {Zork();\n" +
+ " ^^^^^^\n" +
+ "This method requires a body instead of a semicolon\n" +
+ "----------\n" +
+ "5. WARNING in X.java (at line 4)\n" +
+ " sealed interface I{}\n" +
+ " ^^^^^^\n" +
+ "You are using a preview language feature that may or may not be supported in a future release\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index 844e913414..e76af6a7ff 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -193,10 +193,17 @@ public static Test suite() {
ArrayList since_14 = new ArrayList();
since_14.add(SwitchExpressionsYieldTest.class);
since_14.add(RecordsRestrictedClassTest.class);
- since_14.add(PatternMatching14Test.class);
+ since_14.add(PatternMatching15Test.class);
since_14.add(JavadocTestForRecord.class);
since_14.add(BatchCompilerTest_14.class);
+ // add 14 specific test here (check duplicates)
+ ArrayList since_15 = new ArrayList();
+ since_15.add(SealedTypes15Tests.class);
+ since_15.add(ClassFileReaderTest_15.class);
+ since_15.add(JavadocTest_15.class);
+ since_15.add(LocalStaticsTest_15.class);
+ since_15.add(Unicode13Test.class);
// Build final test suite
TestSuite all = new TestSuite(TestAll.class.getName());
all.addTest(new TestSuite(StandAloneASTParserTest.class));
@@ -339,6 +346,23 @@ public static Test suite() {
TestCase.resetForgottenFilters(tests_14);
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14), tests_14));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_15) != 0) {
+ ArrayList tests_15 = (ArrayList)standardTests.clone();
+ tests_15.addAll(since_1_4);
+ tests_15.addAll(since_1_5);
+ tests_15.addAll(since_1_6);
+ tests_15.addAll(since_1_7);
+ tests_15.addAll(since_1_8);
+ tests_15.addAll(since_9);
+ tests_15.addAll(since_10);
+ tests_15.addAll(since_11);
+ tests_15.addAll(since_12);
+ tests_15.addAll(since_13);
+ tests_15.addAll(since_14);
+ tests_15.addAll(since_15);
+ TestCase.resetForgottenFilters(tests_15);
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15), tests_15));
+ }
all.addTest(new TestSuite(Jsr14Test.class));
return all;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
index f9400d4522..dfef5b3a81 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
@@ -33,14 +33,14 @@ public class TextBlockTest extends AbstractRegressionTest {
static {
// TESTS_NUMBERS = new int [] { 40 };
-// TESTS_NAMES = new String[] { "testCompliances_14" };
+// TESTS_NAMES = new String[] { "testCompliances_13" };
}
public static Class<?> testClass() {
return TextBlockTest.class;
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_14);
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
}
public TextBlockTest(String testName){
super(testName);
@@ -51,15 +51,17 @@ public class TextBlockTest extends AbstractRegressionTest {
// Enables the tests to run individually
protected Map<String, String> getCompilerOptions(boolean previewFlag) {
Map<String, String> defaultOptions = super.getCompilerOptions();
- defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, previewFlag ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
return defaultOptions;
}
protected void runConformTest(String[] testFiles, String expectedOutput, Map<String, String> customOptions, String[] vmArguments) {
- runConformTest(testFiles, expectedOutput, customOptions, vmArguments, new JavacTestOptions("-source 14 --enable-preview"));
+ runConformTest(testFiles, expectedOutput, customOptions, vmArguments, new JavacTestOptions("-source 15 "));
+ }
+ protected void runConformTest(String[] testFiles, String expectedOutput, Map<String, String> customOptions) {
+ runConformTest(true, testFiles, null, expectedOutput, null, new JavacTestOptions("-source 15"));
}
protected void runConformTest(
// test directory preparation
@@ -211,8 +213,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - escaped '\'
@@ -231,8 +232,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"abc\\def",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* Positive - Multi line text block with varying indentation
@@ -257,8 +257,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" line 2\n" +
"\n" +
"line 3",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* Positive - Multi line text block with varying indentation
@@ -283,8 +282,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" line 2\n" +
"\n" +
"line 3", // the trailing whitespace is trimmed by the test framework
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* Positive - Multi line text block with varying indentation
@@ -312,8 +310,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"\n" +
" line 3\n" +
">", // the trailing whitespace is trimmed by the test framework
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using unescaped '"' in text block
@@ -332,8 +329,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"\"abc-def",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using escaped '"' in text block
@@ -351,8 +347,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"\"abc-def\"",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using escaped \ and escaped " in text block
@@ -370,8 +365,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"\"abc\"\"\"def",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using Unicode in text block
@@ -391,8 +385,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"true",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - bigger piece of code as text block
@@ -415,8 +408,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"public void print(Object o) {\n" +
" System.out.println(Objects.toString(o));\n" +
"}",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - concatenation of string with text block
@@ -439,8 +431,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"public void print(Object o) {\n" +
" System.out.println(Objects.toString(o));\n" +
"}",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - freely using quotes
@@ -470,8 +461,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"can make words mean so many different things.\"\n" +
"\"The question is,\" said Humpty Dumpty,\n" +
"\"which is to be master - that's all.",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation
@@ -497,8 +487,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation with empty lines
@@ -525,8 +514,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
" </html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation with \r as terminator
@@ -553,8 +541,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation and trailing whitespace
@@ -581,8 +568,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using octal escape char for trailing whitespace
@@ -608,8 +594,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p> \n" +
" </body> \n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using text block as a method argument
@@ -635,8 +620,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
" </html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using variable assigned with text block as a method argument
@@ -663,8 +647,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - assigning strings and text blocks interchangeably.
@@ -692,11 +675,11 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
public void test024() {
runConformTest(
+ true,
new String[] {
"Main.java",
"@SuppressWarnings(\"preview\")\n" +
@@ -724,6 +707,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" }\n" +
"}"
},
+ null,
"public class XYZ {\n" +
" public static String textb = \"\"\"\n" +
" abc\\\"\"\"def\"\n" +
@@ -733,7 +717,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" }\n" +
"}",
null,
- new String[] {"--enable-preview"});
+ JavacTestOptions.DEFAULT);
}
public void test025() {
runNegativeTest(
@@ -798,8 +782,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" bar(MyDay.SUNDAY);\n" +
" }\n" +
" }",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// An empty text block
public void test028() {
@@ -816,8 +799,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// An empty text block
public void test029() {
@@ -836,32 +818,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"Hello Guru", // output comparison tool strips off all trailing whitespace
- getCompilerOptions(),
- new String[] {"--enable-preview"});
- }
- public void testBug550356() {
- Map<String, String> options = getCompilerOptions(false);
- runNegativeTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " public static String textb = \"\"\"\n" +
- "\"\"\";\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(textb);\n" +
- " }\n" +
- "}\n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " public static String textb = \"\"\"\n" +
- "\"\"\";\n" +
- " ^^^^^^^\n" +
- "Text Blocks is a preview feature and disabled by default. Use --enable-preview to enable\n" +
- "----------\n",
- null,
- true,
- options);
+ getCompilerOptions());
}
public void testBug551948_1() {
runConformTest(
@@ -880,8 +837,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", // output comparison tool strips off all trailing whitespace
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_2() {
runConformTest(
@@ -899,8 +855,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"abc\n defghi",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_3() {
runConformTest(
@@ -919,8 +874,7 @@ public class TextBlockTest extends AbstractRegressionTest {
},
"if x == True and \\\n" +
" y == False",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_4() {
runConformTest(
@@ -939,8 +893,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"red green blue orange",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_5() {
runNegativeTest(
@@ -983,8 +936,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"A line with spaces",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_7() {
runConformTest(
@@ -1003,8 +955,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"red \ngreen \nblue", // trailing whitespaces are trimmed
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_8() {
runConformTest(
@@ -1028,8 +979,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"aaa\n\n" +
"bbb\n\n\n" +
"ccc",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_1() {
runConformTest(
@@ -1051,8 +1001,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_2() {
runConformTest(
@@ -1075,8 +1024,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_3() {
runConformTest(
@@ -1099,8 +1047,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_4() {
runConformTest(
@@ -1129,8 +1076,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_5() {
runConformTest(
@@ -1153,8 +1099,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"false",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_6() {
runConformTest(
@@ -1176,8 +1121,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_7() {
runConformTest(
@@ -1199,8 +1143,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_8() {
runConformTest(
@@ -1216,8 +1159,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// Escaped """ with escaping at the first '"'
public void testCompliances_9() {
@@ -1234,8 +1176,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// Escaped """ with escaping at the second '"'
public void testCompliances_10() {
@@ -1252,8 +1193,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// Escaped """ with escaping at the third '"'
public void testCompliances_11() {
@@ -1270,8 +1210,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_12() {
runConformTest(
@@ -1293,8 +1232,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_13() {
runConformTest(
@@ -1315,8 +1253,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"256",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_14() {
runConformTest(
@@ -1340,17 +1277,45 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug553252() {
Map<String, String> defaultOptions = super.getCompilerOptions();
Map<String, String> copy = new HashMap<String, String>(defaultOptions);
- copy.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_13);
- copy.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_13);
- copy.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_13);
+ copy.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.DISABLED);
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static String textb = \"\"\"\n" +
+ "\"\"\";\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(textb);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public static String textb = \"\"\"\n" +
+ "\"\"\";\n" +
+ " ^^^^^^^\n" +
+ "The Java feature \'Text Blocks\' is only available with source level 15 and above\n" +
+ "----------\n",
+ null,
+ true,
+ new String[] {"-source 14 "},
+ copy);
+ }
+ public void testBug553252b() {
+ Map<String, String> defaultOptions = super.getCompilerOptions();
+ Map<String, String> copy = new HashMap<String, String>(defaultOptions);
+ copy.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
copy.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
- copy.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
runNegativeTest(
new String[] {
"X.java",
@@ -1366,10 +1331,11 @@ public class TextBlockTest extends AbstractRegressionTest {
"1. ERROR in X.java (at line 0)\n" +
" public class X {\n" +
" ^\n" +
- "Preview features enabled at an invalid source release level 13, preview can be enabled only at source level 14\n" +
+ "Preview features enabled at an invalid source release level 14, preview can be enabled only at source level 15\n" +
"----------\n",
null,
true,
+ new String[] {"-source 14 --enable-preview"},
copy);
}
public void testBug562460() {
@@ -1385,8 +1351,87 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
+ }
+ public void testCompliances_15() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static String textb = \"\"\"\n" +
+ " \\baa\"\"\";\n" +
+ " public static void main(String[] args) {\n" +
+ " print(textb.toCharArray());\n" +
+ " }\n" +
+ " private static void print(char[] val) {\n" +
+ " for (char c : val) {\n" +
+ " System.out.print((int)c + \",\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ },
+ "8,97,97,",
+ getCompilerOptions());
+ }
+ public void testCompliances_16() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static String textb = \"\"\"\n" +
+ " \\baa\"\"\";\n" +
+ " public static void main(String[] args) {\n" +
+ " print(textb.toCharArray());\n" +
+ " }\n" +
+ " private static void print(char[] val) {\n" +
+ " for (char c : val) {\n" +
+ " System.out.print((int)c + \",\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ },
+ "8,97,97,",
+ getCompilerOptions());
+ }
+ public void testCompliances_17() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static String textb = \"\"\"\n" +
+ "\\t\\baa\"\"\";\n" +
+ " public static void main(String[] args) {\n" +
+ " print(textb.toCharArray());\n" +
+ " }\n" +
+ " private static void print(char[] val) {\n" +
+ " for (char c : val) {\n" +
+ " System.out.print((int)c + \",\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ },
+ "9,8,97,97,",
+ getCompilerOptions());
+ }
+ public void testCompliances_18() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static String textb = \"\"\"\n" +
+ "\\013\\baa\"\"\";\n" +
+ " public static void main(String[] args) {\n" +
+ " print(textb.toCharArray());\n" +
+ " }\n" +
+ " private static void print(char[] val) {\n" +
+ " for (char c : val) {\n" +
+ " System.out.print((int)c + \",\");\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ },
+ "11,8,97,97,",
+ getCompilerOptions());
}
public void testBug565639_1() {
runConformTest(true,
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode13Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode13Test.java
new file mode 100644
index 0000000000..eb0a5b1f14
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode13Test.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2019, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.util.Map;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+public class Unicode13Test extends AbstractRegressionTest {
+public Unicode13Test(String name) {
+ super(name);
+}
+public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
+}
+public void test1() {
+ Map<String, String> options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public int a\\u08BE; // new unicode character in unicode 13 \n" +
+ "}",
+ },
+ "",
+ options);
+}
+public void test2() {
+ Map<String, String> options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public int a\\ud880\\udc00; // new unicode character in unicode 13 using high and low surrogate\n" +
+ "}",
+ },
+ "",
+ options);
+}
+public static Class<Unicode13Test> testClass() {
+ return Unicode13Test.class;
+}
+}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java
index 52bce52859..64a71cf253 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java
@@ -39,7 +39,7 @@ public class VarargsTest extends AbstractComparableTest {
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which does not belong to the class are skipped...
static {
-// TESTS_NAMES = new String[] { "test070b" };
+// TESTS_NAMES = new String[] { "test068" };
// TESTS_NUMBERS = new int[] { 61 };
// TESTS_RANGE = new int[] { 11, -1 };
}
@@ -2702,6 +2702,9 @@ public class VarargsTest extends AbstractComparableTest {
if (this.complianceLevel < ClassFileConstants.JDK1_7) return;
Map options = getCompilerOptions();
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.ERROR);
+
+ String[] bounds = new String[] { "Object","Serializable","Comparable<?>"};
+ String[] bounds15 = new String[] { "Object","Serializable","Comparable<?>", "Constable"};
this.runNegativeTest(
new String[] {
"X.java",
@@ -2730,7 +2733,7 @@ public class VarargsTest extends AbstractComparableTest {
"2. WARNING in X.java (at line 13)\n" +
" classes = X.asList2(String.class, Boolean.class);\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Type safety: A generic array of Class<? extends "+intersection("Object","Serializable","Comparable<?>")+"> is created for a varargs parameter\n" +
+ "Type safety: A generic array of Class<? extends "+intersection(isJRE15Plus ? bounds15 : bounds)+"> is created for a varargs parameter\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=337795 (test effect of SuppressWarnings (should suppress at declaration site, but not at call site)
@@ -2738,6 +2741,8 @@ public class VarargsTest extends AbstractComparableTest {
if (this.complianceLevel < ClassFileConstants.JDK1_7) return;
Map options = getCompilerOptions();
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.ERROR);
+ String[] bounds = new String[] { "Object","Serializable","Comparable<?>"};
+ String[] bounds15 = new String[] { "Object","Serializable","Comparable<?>", "Constable"};
this.runNegativeTest(
new String[] {
"X.java",
@@ -2762,7 +2767,7 @@ public class VarargsTest extends AbstractComparableTest {
"1. WARNING in X.java (at line 14)\n" +
" classes = X.asList2(String.class, Boolean.class);\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Type safety: A generic array of Class<? extends "+intersection("Object","Serializable","Comparable<?>")+"> is created for a varargs parameter\n" +
+ "Type safety: A generic array of Class<? extends "+intersection(isJRE15Plus ? bounds15 : bounds)+ "> is created for a varargs parameter\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=346042
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
index 0dee50504d..dbde1223af 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2019 IBM Corporation and others.
+ * Copyright (c) 2010, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -65,7 +65,7 @@ public class StandAloneASTParserTest extends AbstractRegressionTest {
super(name);
}
- private static final int AST_JLS_LATEST = AST.JLS14;
+ private static final int AST_JLS_LATEST = AST.JLS15;
public ASTNode runConversion(
int astLevel,
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
index 25f31d6980..5da30c5524 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -46,6 +46,7 @@ public class AbstractCompilerTest extends TestCase {
public static final int F_12 = 0x200;
public static final int F_13 = 0x400;
public static final int F_14 = 0x800;
+ public static final int F_15 = 0x1000;
public static final boolean RUN_JAVAC = CompilerOptions.ENABLED.equals(System.getProperty("run.javac"));
private static final int UNINITIALIZED = -1;
@@ -54,11 +55,14 @@ public class AbstractCompilerTest extends TestCase {
protected long complianceLevel;
protected boolean enableAPT = false;
+ protected boolean enablePreview = false;
protected static boolean isJRE9Plus = false; // Stop gap, so tests need not be run at 9, but some tests can be adjusted for JRE 9
+ protected static boolean isJRE10Plus = false;
protected static boolean isJRE11Plus = false;
protected static boolean isJRE12Plus = false;
protected static boolean isJRE13Plus = false;
protected static boolean isJRE14Plus = false;
+ protected static boolean isJRE15Plus = false;
protected static boolean reflectNestedClassUseDollar;
/**
@@ -112,6 +116,9 @@ public class AbstractCompilerTest extends TestCase {
if ((complianceLevels & AbstractCompilerTest.F_14) != 0) {
suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14)));
}
+ if ((complianceLevels & AbstractCompilerTest.F_15) != 0) {
+ suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15)));
+ }
}
/**
@@ -163,6 +170,9 @@ public class AbstractCompilerTest extends TestCase {
if ((complianceLevels & AbstractCompilerTest.F_14) != 0) {
suite.addTest(buildComplianceTestSuite(testClasses, setupClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14)));
}
+ if ((complianceLevels & AbstractCompilerTest.F_15) != 0) {
+ suite.addTest(buildComplianceTestSuite(testClasses, setupClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15)));
+ }
return suite;
}
@@ -327,6 +337,7 @@ public class AbstractCompilerTest extends TestCase {
}
}
checkCompliance(evaluationTestClass, minimalCompliance, suite, complianceLevels, AbstractCompilerTest.F_14, ClassFileConstants.MAJOR_VERSION_14, 14);
+ checkCompliance(evaluationTestClass, minimalCompliance, suite, complianceLevels, AbstractCompilerTest.F_15, ClassFileConstants.MAJOR_VERSION_15, 15);
return suite;
}
private static void checkCompliance(Class evaluationTestClass, int minimalCompliance, TestSuite suite,
@@ -396,6 +407,9 @@ public class AbstractCompilerTest extends TestCase {
*/
public static long highestComplianceLevels() {
int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
+ if ((complianceLevels & AbstractCompilerTest.F_15) != 0) {
+ return ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15);
+ }
if ((complianceLevels & AbstractCompilerTest.F_14) != 0) {
return ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14);
}
@@ -458,12 +472,13 @@ public class AbstractCompilerTest extends TestCase {
public static int getPossibleComplianceLevels() {
if (possibleComplianceLevels == UNINITIALIZED) {
String specVersion = System.getProperty("java.specification.version");
- isJRE14Plus = CompilerOptions.VERSION_14.equals(specVersion);
+ isJRE15Plus = CompilerOptions.VERSION_15.equals(specVersion);
+ isJRE14Plus = isJRE15Plus || CompilerOptions.VERSION_14.equals(specVersion);
isJRE13Plus = isJRE14Plus || CompilerOptions.VERSION_13.equals(specVersion);
isJRE12Plus = isJRE13Plus || CompilerOptions.VERSION_12.equals(specVersion);
isJRE11Plus = isJRE12Plus || CompilerOptions.VERSION_11.equals(specVersion);
- isJRE9Plus = isJRE11Plus || CompilerOptions.VERSION_9.equals(specVersion)
- || CompilerOptions.VERSION_10.equals(specVersion);
+ isJRE10Plus = isJRE11Plus || CompilerOptions.VERSION_10.equals(specVersion);
+ isJRE9Plus = isJRE10Plus || CompilerOptions.VERSION_9.equals(specVersion);
initReflectionVersion();
String compliances = System.getProperty("compliance");
if (compliances != null) {
@@ -482,17 +497,26 @@ public class AbstractCompilerTest extends TestCase {
} else if (CompilerOptions.VERSION_1_8.equals(compliance)) {
possibleComplianceLevels |= F_1_8;
} else if (CompilerOptions.VERSION_9.equals(compliance)) {
- possibleComplianceLevels |= F_9;
+ if (isJRE9Plus)
+ possibleComplianceLevels |= F_9;
} else if (CompilerOptions.VERSION_10.equals(compliance)) {
- possibleComplianceLevels |= F_10;
+ if (isJRE10Plus)
+ possibleComplianceLevels |= F_10;
} else if (CompilerOptions.VERSION_11.equals(compliance)) {
- possibleComplianceLevels |= F_11;
+ if (isJRE11Plus)
+ possibleComplianceLevels |= F_11;
} else if (CompilerOptions.VERSION_12.equals(compliance)) {
- possibleComplianceLevels |= F_12;
+ if (isJRE12Plus)
+ possibleComplianceLevels |= F_12;
} else if (CompilerOptions.VERSION_13.equals(compliance)) {
- possibleComplianceLevels |= F_13;
+ if (isJRE13Plus)
+ possibleComplianceLevels |= F_13;
} else if (CompilerOptions.VERSION_14.equals(compliance)) {
- possibleComplianceLevels |= F_14;
+ if (isJRE14Plus)
+ possibleComplianceLevels |= F_14;
+ } else if (CompilerOptions.VERSION_15.equals(compliance)) {
+ if (isJRE15Plus)
+ possibleComplianceLevels |= F_15;
} else {
System.out.println("Ignoring invalid compliance (" + compliance + ")");
System.out.print("Use one of ");
@@ -508,7 +532,8 @@ public class AbstractCompilerTest extends TestCase {
System.out.print(CompilerOptions.VERSION_11 + ", ");
System.out.print(CompilerOptions.VERSION_12 + ", ");
System.out.print(CompilerOptions.VERSION_13 + ", ");
- System.out.println(CompilerOptions.VERSION_14);
+ System.out.println(CompilerOptions.VERSION_14 + ", ");
+ System.out.println(CompilerOptions.VERSION_15);
}
}
if (possibleComplianceLevels == 0) {
@@ -566,6 +591,10 @@ public class AbstractCompilerTest extends TestCase {
if (canRun14) {
possibleComplianceLevels |= F_14;
}
+ boolean canRun15 = canRun14 && !CompilerOptions.VERSION_14.equals(specVersion);
+ if (canRun15) {
+ possibleComplianceLevels |= F_15;
+ }
} else if ("1.0".equals(specVersion)
|| CompilerOptions.VERSION_1_1.equals(specVersion)
|| CompilerOptions.VERSION_1_2.equals(specVersion)
@@ -592,6 +621,9 @@ public class AbstractCompilerTest extends TestCase {
possibleComplianceLevels |= F_13;
if (!CompilerOptions.VERSION_13.equals(specVersion)) {
possibleComplianceLevels |= F_14;
+ if (!CompilerOptions.VERSION_14.equals(specVersion)) {
+ possibleComplianceLevels |= F_15;
+ }
}
}
}
@@ -769,7 +801,7 @@ public class AbstractCompilerTest extends TestCase {
}
protected static String getVersionString(long compliance) {
- String version = "version 14 : 58.0";
+ String version = "version 15 : 59.0";
if (compliance < ClassFileConstants.JDK9) return "version 1.8 : 52.0";
if (compliance == ClassFileConstants.JDK9) return "version 9 : 53.0";
if (compliance == ClassFileConstants.JDK10) return "version 10 : 54.0";
@@ -778,7 +810,7 @@ public class AbstractCompilerTest extends TestCase {
int major = Integer.parseInt(ver) + ClassFileConstants.MAJOR_VERSION_0;
return "version " + ver + " : " + major + ".0";
}
- if (compliance >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14)) return version; // keep this stmt for search for next bump up
+ if (compliance >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15)) return version; // keep this stmt for search for next bump up
return version;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
index 39c6e45af4..69d0d40fca 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -458,6 +458,12 @@ public static void createJar(String[] pathsAndContents, String[] extraPathsAndCo
}
zip(classesDir, jarPath);
}
+public static void createJar(String[] javaPathsAndContents, String jarPath, String compliance, boolean preview) throws IOException {
+ Map options = getCompileOptions(compliance);
+ if (preview)
+ options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
+ createJar(javaPathsAndContents, null, options, null, jarPath);
+}
public static void createJar(String[] javaPathsAndContents, String jarPath, String compliance) throws IOException {
createJar(javaPathsAndContents, null, jarPath, compliance);
}
diff --git a/org.eclipse.jdt.core.tests.compiler/test.xml b/org.eclipse.jdt.core.tests.compiler/test.xml
index afe7e7ccfb..b421dbdaf5 100644
--- a/org.eclipse.jdt.core.tests.compiler/test.xml
+++ b/org.eclipse.jdt.core.tests.compiler/test.xml
@@ -56,6 +56,7 @@
<property name="plugin-name" value="${plugin-name}"/>
<property name="classname"
value="org.eclipse.jdt.core.tests.compiler.regression.TestAll"/>
+ <property name="vmargs" value="-Dcompliance=1.4,1.7,1.8,15"/>
</ant>
<antcall target="evaluation_tests"/>
diff --git a/org.eclipse.jdt.core.tests.model/Build JCL Mins.launch b/org.eclipse.jdt.core.tests.model/Build JCL Mins.launch
new file mode 100644
index 0000000000..6e441714cb
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/Build JCL Mins.launch
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType">
+ <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+ <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/org.eclipse.jdt.core.tests.model/JCL&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/eclipse.jdt.core/org.eclipse.jdt.core.tests.model/JCL/build.xml"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+ <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jdt.core.tests.model"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+ <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.jdt.core.tests.model/JCL/build.xml}"/>
+ <stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.jdt.core.tests.model/JCL}"/>
+ <stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
+</launchConfiguration>
diff --git a/org.eclipse.jdt.core.tests.model/JCL/build.xml b/org.eclipse.jdt.core.tests.model/JCL/build.xml
new file mode 100644
index 0000000000..ddc9f081bb
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/build.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2020 GK Software SE and others.
+
+ This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License 2.0
+ which accompanies this distribution, and is available at
+ https://www.eclipse.org/legal/epl-2.0/
+
+ SPDX-License-Identifier: EPL-2.0
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+ -->
+
+<project name="export-JCLmins" default="allConverterJcls" basedir=".">
+ <property name="jclbase" value="${basedir}/../../JCL"/>
+
+ <target name="build" depends="converterJclMin"/>
+
+ <target name="allConverterJcls">
+ <!--antcall target="converterJclMin">
+ <param name="compliance" value="1.4"/>
+ <param name="suffix" value=""/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="1.5"/>
+ <param name="suffix" value="1.5"/>
+ </antcall-->
+ <antcall target="converterJclMin">
+ <param name="compliance" value="1.7"/>
+ <param name="suffix" value="1.7"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="1.8"/>
+ <param name="suffix" value="1.8"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="9"/>
+ <param name="suffix" value="9"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="10"/>
+ <param name="suffix" value="10"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="11"/>
+ <param name="suffix" value="11"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="12"/>
+ <param name="suffix" value="12"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="13"/>
+ <param name="suffix" value="13"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="14"/>
+ <param name="suffix" value="14"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="15"/>
+ <param name="suffix" value="15"/>
+ </antcall>
+ </target>
+ <target name="converterJclMin">
+ <javac srcdir="${jclbase}/converterJclMin${suffix}/src" destdir="${jclbase}/converterJclMin${suffix}/bin"
+ debuglevel="lines,source"
+ source="${compliance}"
+ target="${compliance}">
+ <compilerarg line="-Xlint:none"/>
+ </javac>
+ <jar destfile="${basedir}/converterJclMin${suffix}.jar" basedir="${jclbase}/converterJclMin${suffix}/bin"/>
+ <zip destfile="${basedir}/converterJclMin${suffix}src.zip">
+ <fileset dir="${jclbase}/converterJclMin${suffix}/src" />
+ </zip>
+ </target>
+</project>
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
index 5c8eae7a24..3a45069526 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar
index a064a8721d..9c0a735a1c 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5src.zip
index cb3ef5e5ae..8fd67219ac 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
index a2e54e15a6..1aa97affe1 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7src.zip
index 9dbb4151f6..8dc3f8ca77 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
index 42518444d0..cbed395df7 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8src.zip
index ce569beb02..b966b0d386 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
index 3cc6d95218..11f8d89292 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10src.zip
index 23ce774f5e..88f184dfce 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
index 3cc6d95218..dcb69d5f4e 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11src.zip
index 23ce774f5e..7a91fedf0a 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
index 3cc6d95218..2d6cbe4c1f 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip
index 23ce774f5e..7a91fedf0a 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
index 929343894c..5938fbe8a4 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip
index 7b0fabee94..c3f8a91ac4 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar
index e6860c6720..c85d2bee6d 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14src.zip
index a3b53b46b5..8defabc74f 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar
new file mode 100644
index 0000000000..f69bef04df
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip
new file mode 100644
index 0000000000..4b627635e7
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
index 4a59a6138e..5116d05a3d 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9src.zip
index 031b53aa47..9b811accc4 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip
index d8ff520af1..1b34dee86b 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMinsrc.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
index 927779b989..3c82a7b86f 100644
--- a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.model;singleton:=true
-Bundle-Version: 3.10.1300.qualifier
+Bundle-Version: 3.10.1350.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests,
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index 8e3943c9d8..476e9114ea 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.model</artifactId>
- <version>3.10.1300-SNAPSHOT</version>
+ <version>3.10.1350-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
@@ -232,6 +232,37 @@
<tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,13,14</tycho.surefire.argLine>
</properties>
</profile>
+ <profile>
+ <id>test-on-javase-15</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-toolchains-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>toolchain</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <toolchains>
+ <jdk>
+ <id>JavaSE-15</id>
+ </jdk>
+ </toolchains>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <!-- Overridden in https://ci.eclipse.org/jdt/job/eclipse.jdt.core-run.javac-15/configure -->
+ <tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,13,14,15</tycho.surefire.argLine>
+ </properties>
+ </profile>
</profiles>
</project>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava14Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava14Tests.java
index 7336c26fee..522a572858 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava14Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava14Tests.java
@@ -17,7 +17,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.jdt.core.tests.dom.ConverterTestSetup;
-import org.eclipse.jdt.core.tests.model.JavaSearchBugs14Tests;
import org.eclipse.jdt.core.tests.model.JavaSearchBugs14SwitchExpressionTests;
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
@@ -33,7 +32,7 @@ public class RunAllJava14Tests extends TestCase {
}
public static Class[] getAllTestClasses() {
return new Class[] {
- JavaSearchBugs14Tests.class,JavaSearchBugs14SwitchExpressionTests.class
+ JavaSearchBugs14SwitchExpressionTests.class
};
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava14Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava14Tests.java
index 18215af789..c39d0b58ad 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava14Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava14Tests.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.jdt.core.tests.dom.ConverterTestSetup;
-import org.eclipse.jdt.core.tests.model.JavaSearchBugs14Tests;
import org.eclipse.jdt.core.tests.model.CompletionTests14;
import org.eclipse.jdt.core.tests.model.JavaSearchBugs14SwitchExpressionTests;
@@ -35,7 +34,7 @@ public class RunOnlyJava14Tests extends TestCase {
}
public static Class[] getAllTestClasses() {
return new Class[] {
- JavaSearchBugs14Tests.class,JavaSearchBugs14SwitchExpressionTests.class, CompletionTests14.class
+ JavaSearchBugs14SwitchExpressionTests.class, CompletionTests14.class
};
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter14Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter14Test.java
index d7abf7c47a..3bcbbf8bce 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter14Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter14Test.java
@@ -16,7 +16,6 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
@@ -24,27 +23,17 @@ import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.BreakStatement;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.IBinding;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.IVariableBinding;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.SwitchCase;
import org.eclipse.jdt.core.dom.SwitchExpression;
import org.eclipse.jdt.core.dom.SwitchStatement;
-import org.eclipse.jdt.core.dom.TextBlock;
import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import org.eclipse.jdt.core.dom.YieldStatement;
@@ -52,6 +41,12 @@ import org.eclipse.jdt.core.dom.YieldStatement;
import junit.framework.AssertionFailedError;
import junit.framework.Test;
+/*
+ * This test, although originally was created for AST Level 14,
+ * during the second iteration of preview feature Records,
+ * being migrated to AST 15.
+ *
+ */
@SuppressWarnings("rawtypes")
public class ASTConverter14Test extends ConverterTestSetup {
@@ -61,11 +56,9 @@ public class ASTConverter14Test extends ConverterTestSetup {
public void setUpSuite() throws Exception {
super.setUpSuite();
this.ast = AST.newAST(getAST14(), false);
- if (this.ast.apiLevel() == AST.JLS14 ) {
- this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
- this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
- this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
- }
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
+ this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
}
public ASTConverter14Test(String name) {
@@ -81,6 +74,7 @@ public class ASTConverter14Test extends ConverterTestSetup {
return buildModelTestSuite(ASTConverter14Test.class);
}
+ @SuppressWarnings("deprecation")
static int getAST14() {
return AST.JLS14;
}
@@ -91,10 +85,12 @@ public class ASTConverter14Test extends ConverterTestSetup {
this.workingCopy = null;
}
}
+
+
/*
* Test that a simple switch expression's return type holds the correct type
*/
- public void _test0001() throws JavaModelException {
+ public void test0001() throws JavaModelException {
String contents =
" public class X {\n" +
" enum Day\n" +
@@ -227,7 +223,7 @@ public class ASTConverter14Test extends ConverterTestSetup {
}
- public void _test0004() throws JavaModelException {
+ public void test0004() throws JavaModelException {
String contents =
"public class X {\n" +
" static enum Day {MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY, SATURDAY,SUNDAY}\n" +
@@ -326,45 +322,9 @@ public class ASTConverter14Test extends ConverterTestSetup {
assertEquals("incorrect node type", ASTNode.STRING_LITERAL, expression2.getNodeType());
}
- public void _test0006() throws JavaModelException {
- String contents =
- "public class X {\n" +
- " public String test001() {\n" +
- " int i = 0;\n" +
- " String ret = switch(i%2) {\n" +
- " case 0 -> {return \"odd\"; }\n" +
- " case 1 -> \"even\";\n" +
- " default -> \"\";\n" +
- " };\n" +
- " return ret;\n" +
- " }" +
- "}" ;
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- List fragments = ((VariableDeclarationStatement) node).fragments();
- assertEquals("Incorrect no of fragments", 1, fragments.size());
- node = (ASTNode) fragments.get(0);
- assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
- Expression initializer = fragment.getInitializer();
- List statements = ((SwitchExpression) initializer).statements();
- assertEquals("incorrect no of statements", 6, statements.size());
- Block block = (Block) statements.get(1);
- statements = block.statements();
- assertEquals("incorrect no of statements", 1, statements.size());
- Statement stmt = (Statement) statements.get(0);
- assertEquals("incorrect node type", ASTNode.RETURN_STATEMENT, stmt.getNodeType());
-
- }
// Moved over from ASTConverter9Test
- public void _testBug531714_015() throws CoreException {
+ @SuppressWarnings("deprecation")
+ public void testBug531714_015() throws CoreException {
// saw NPE in SwitchExpression.resolveType(SwitchExpression.java:423)
if (!isJRE14) {
System.err.println("Test "+getName()+" requires a JRE 14");
@@ -450,172 +410,7 @@ public class ASTConverter14Test extends ConverterTestSetup {
}
}
- public void _test0007() throws JavaModelException {
- String contents =
- "public class X {\n" +
- " public String test001() {\n" +
- " String s = \"\"\"\n" +
- " <html>\n" +
- " <body>\n" +
- " <p>Hello, world</p>\n" +
- " </body>\n" +
- " </html>\n" +
- " \"\"\";\n" +
- " System.out.println(s);" +
- " return s;\n" +
- " }" +
- "}" ;
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Text block statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- List fragments = ((VariableDeclarationStatement) node).fragments();
- assertEquals("Incorrect no of fragments", 1, fragments.size());
- node = (ASTNode) fragments.get(0);
- assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
- Expression initializer = fragment.getInitializer();
- assertTrue("Initializer is not a TextBlock", initializer instanceof TextBlock);
- String escapedValue = ((TextBlock) initializer).getEscapedValue();
-
- assertTrue("String should not be empty", escapedValue.length() != 0);
- assertTrue("String should start with \"\"\"", escapedValue.startsWith("\"\"\""));
-
- String literal = ((TextBlock) initializer).getLiteralValue();
- assertEquals("literal value not correct",
- " <html>\n" +
- " <body>\n" +
- " <p>Hello, world</p>\n" +
- " </body>\n" +
- " </html>\n" +
- " ",
- literal);
-
- }
- public void _test0008() throws JavaModelException {
- String contents =
- "public class X {\n" +
- " public String test001() {\n" +
- " String s = \"\"\"\n" +
- " <html>\n" +
- " <body>\n" +
- " <p>Hello, world</p>\n" +
- " </body>\n" +
- " </html>\n" +
- " \"\"\";\n" +
- " System.out.println(s);" +
- " return s;\n" +
- " }" +
- "}" ;
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- try {
- buildAST(
- contents,
- this.workingCopy);
- } catch(UnsupportedOperationException e) {
- fail("Should not throw UnsupportedOperationException");
- } catch(AssertionFailedError e) {
- e.printStackTrace();
- return;
- }
- fail("Compilation should not succeed");
-
- }
- public void _test0009() throws JavaModelException {
- String contents =
- "public class X {\n" +
- " public String test001() {\n" +
- " String s = \"\"\"\n" +
- " <html>\n" +
- " <body>\n" +
- " <p>Hello, world</p>\n" +
- " </body>\n" +
- " </html>\n" +
- " \"\"\";\n" +
- " System.out.println(s);" +
- " return s;\n" +
- " }" +
- "}" ;
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Text block statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- List fragments = ((VariableDeclarationStatement) node).fragments();
- assertEquals("Incorrect no of fragments", 1, fragments.size());
- node = (ASTNode) fragments.get(0);
- assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
- Expression initializer = fragment.getInitializer();
- assertTrue("Initializer is not a TextBlock", initializer instanceof TextBlock);
- ITypeBinding binding = initializer.resolveTypeBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong qualified name", "java.lang.String", binding.getQualifiedName());
-
- String escapedValue = ((TextBlock) initializer).getEscapedValue();
-
- assertTrue("String should not be empty", escapedValue.length() != 0);
- assertTrue("String should start with \"\"\"", escapedValue.startsWith("\"\"\""));
- assertEquals("escaped value not correct",
- "\"\"\"\n" +
- " <html>\n" +
- " <body>\n" +
- " <p>Hello, world</p>\n" +
- " </body>\n" +
- " </html>\n" +
- " \"\"\"",
- escapedValue);
-
- String literal = ((TextBlock) initializer).getLiteralValue();
- assertEquals("literal value not correct",
- " <html>\n" +
- " <body>\n" +
- " <p>Hello, world</p>\n" +
- " </body>\n" +
- " </html>\n" +
- " ",
- literal);
- }
- public void _test0010() throws JavaModelException {
- String contents =
- "public class test14 {\n" +
- " public static void main(String[] args) {\n" +
- " String s = \"\"\"\n" +
- " nadknaks vgvh \n" +
- " \"\"\";\n" +
- "\n" +
- " int m = 10;\n" +
- " m = m* 6;\n" +
- " System.out.println(s);\n" +
- " }\n" +
- "}" ;
- this.workingCopy = getWorkingCopy("/Converter14/src/test14.java", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("wrong line number", 3, compilationUnit.getLineNumber(node.getStartPosition()));
- node = getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("wrong line number", 7, compilationUnit.getLineNumber(node.getStartPosition()));
- node = getASTNode(compilationUnit, 0, 0, 2);
- assertEquals("wrong line number", 8, compilationUnit.getLineNumber(node.getStartPosition()));
- node = getASTNode(compilationUnit, 0, 0, 3);
- assertEquals("wrong line number", 9, compilationUnit.getLineNumber(node.getStartPosition()));
- }
-
- public void _test0011() throws CoreException {
+ public void test0011() throws CoreException {
// saw NPE in SwitchExpression.resolveType(SwitchExpression.java:423)
if (!isJRE14) {
System.err.println("Test "+getName()+" requires a JRE 14");
@@ -653,378 +448,38 @@ public class ASTConverter14Test extends ConverterTestSetup {
}
- public void testRecord001() throws CoreException {
+ public void testTextBlock002() throws JavaModelException {
if (!isJRE14) {
System.err.println("Test "+getName()+" requires a JRE 14");
return;
}
String contents =
- "public record X() {\n" +
- " public X {\n" +
- " System.out.println(\"no error\");\n" +
- " }\n" +
- "\n" +
- "}\n";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- /**
- * Added for Bug 561193 - [14]record keyword inside method not colored correctly
- * @throws CoreException
- */
- public void testRecord002() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
- return;
- }
- String contents =
- "public record X(int param1, int param2) {\n" +
- " public X {\n" +
- " if (param1 > 5) {\n" +
- " System.out.println(\"error\");\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- public void testRecord003() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
- return;
- }
- String contents =
- "public record X(int param1, int param2) {\n" +
- " public X {\n" +
- " if (param1 > 5) {\n" +
- " System.out.println(\"error\");\n" +
- " }\n" +
- " }\n" +
- "\n" +
- " public X(int a) {\n" +
- " this(6, 16);\n" +
- " a = 6;\n" +
- " }\n" +
- "}\n";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- public void testRecord004() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test " + getName() + " requires a JRE 14");
- return;
- }
- String contents = "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " record R(int x,int y){}\n" +
- " R r = new R(100, 200);\n" +
- " System.out.println(r.x());\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/* resolve */);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(contents, this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List<ASTNode> statements = methodDeclaration.getBody().statements();
- node = statements.get(0);
- assertEquals("Not a TypDeclaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- TypeDeclarationStatement tdStmt = (TypeDeclarationStatement) node;
- node = tdStmt.getDeclaration();
- assertEquals("Not a RecordDeclaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- public void testRecord005() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
- return;
- }
- String contents = "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " record R(int x,String y){}\n" +
- " R r = new R(100, \"Point\");\n" +
- " System.out.println(r.x());\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
- MethodDeclaration methodDeclaration = (MethodDeclaration) node;
- List<ASTNode> statements = methodDeclaration.getBody().statements();
- node = statements.get(0);
- assertEquals("Not a TypDeclaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- TypeDeclarationStatement tdStmt = (TypeDeclarationStatement) node;
- node = tdStmt.getDeclaration();
- assertEquals("Not a RecordDeclaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
- RecordDeclaration record = (RecordDeclaration)node;
- List<SingleVariableDeclaration> recordComponents = record.recordComponents();
- assertEquals("There should be 2 record components", 2, recordComponents.size());
- SingleVariableDeclaration recordComponent = recordComponents.get(0);
- assertEquals("First record component name should be x","x" , recordComponent.getName().toString());
- assertEquals("First record component type is int" , "int", recordComponent.getType().toString());
- IVariableBinding resolveBinding = recordComponent.resolveBinding();
- assertEquals("First record component binding" , true, resolveBinding.isRecordComponent());
- recordComponent = recordComponents.get(1);
- assertEquals("Second record component name should be y","y" , recordComponent.getName().toString());
- assertEquals("Second record component type is String" , "String", recordComponent.getType().toString());
- resolveBinding = recordComponent.resolveBinding();
- assertEquals("Second record component binding" , true, resolveBinding.isRecordComponent());
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- public void testRecord006() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
- return;
- }
- String contents = "import java.lang.annotation.ElementType;\n" +
- "import java.lang.annotation.Target;\n" +
- "record X(@MyAnnot int lo) {\n" +
- " public int lo() {\n" +
- " return this.lo;\n" +
- " }\n" +
- "\n" +
- "}\n" +
- "@Target({ElementType.FIELD})\n" +
- "@interface MyAnnot {}";
+ "public class X {\n" +
+ " public String test001() {\n" +
+ " String s = \"\"\"\n" +
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " \"\"\";\n" +
+ " System.out.println(s);" +
+ " return s;\n" +
+ " }" +
+ "}" ;
this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
+ buildAST(
contents,
this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
- assertEquals("Not a Record Declaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
- RecordDeclaration record = (RecordDeclaration)node;
- List<SingleVariableDeclaration> recordComponents = record.recordComponents();
- assertEquals("There should be 1 record component", 1, recordComponents.size());
- SingleVariableDeclaration recordComponent = recordComponents.get(0);
- assertEquals("Record component name should be lo","lo" , recordComponent.getName().toString());
- assertEquals("Record component type is int" , "int", recordComponent.getType().toString());
- IVariableBinding resolveBinding = recordComponent.resolveBinding();
- assertEquals("Record component binding" , true, resolveBinding.isRecordComponent());
- MarkerAnnotation annotation = (MarkerAnnotation)recordComponent.modifiers().get(0);
- assertEquals("Record component annotation name should be MyAnnot","@MyAnnot" , annotation.toString());
- assertEquals("Record component binding should not have annotation",0 , resolveBinding.getAnnotations().length);
-
-
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- public void testRecord007() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
+ } catch(UnsupportedOperationException e) {
+ fail("Should not throw UnsupportedOperationException");
+ } catch(AssertionFailedError e) {
+ e.printStackTrace();
return;
}
- String contents = "record X(int lo) {\n" +
- " public int lo() {\n" +
- " return this.lo;\n" +
- " }\n" +
- "\n" +
- "}\n";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
- assertEquals("Not a Record Declaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
- RecordDeclaration record = (RecordDeclaration)node;
- List<SingleVariableDeclaration> recordComponents = record.recordComponents();
- assertEquals("There should be 1 record component", 1, recordComponents.size());
- SingleVariableDeclaration recordComponent = recordComponents.get(0);
- SimpleName recordComponentName = recordComponent.getName();
- assertEquals("Record component name should be lo","lo" , recordComponentName.toString());
- ITypeBinding resolveTypeBinding = recordComponentName.resolveTypeBinding();
- assertEquals("Record component type is int" , "int",resolveTypeBinding.getName() );
- IVariableBinding resolveBinding = (IVariableBinding)recordComponentName.resolveBinding();
- assertEquals("Record component binding" , true, resolveBinding.isRecordComponent());
-
+ fail("Compilation should not succeed");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
}
- public void testRecordConstructor001() throws CoreException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
- return;
- }
- String contents = "record X(int lo) {\n" +
- " public X {\n" +
- " \n}\n" +
- " public X(String str) {\n" +
- " this((str != null) ? str.length() : 0);\n" +
- " \n}\n" +
- " public int abc() {\n" +
- " return this.lo;\n" +
- " }\n" +
- "\n" +
- "}\n";
- this.workingCopy = getWorkingCopy("/Converter14/src/X.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
- assertEquals("Not a Type", ASTNode.RECORD_DECLARATION, node.getNodeType());
-
- ASTParser parser= ASTParser.newParser(getAST14());
- parser.setProject(javaProject);
- IBinding[] bindings = parser.createBindings(new IJavaElement[] { this.workingCopy.findPrimaryType() }, null);
- IMethodBinding methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[0];
- assertEquals("compact constructor name", "X", methodBinding.getName());
- assertTrue("not a Constructor", methodBinding.isConstructor());
- assertTrue("not a CompactConstructor", methodBinding.isCompactConstructor());
- methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[1];
- assertEquals("constructor name", "X", methodBinding.getName());
- assertTrue("not a Constructor", methodBinding.isConstructor());
- assertFalse("Is CompactConstructor?", methodBinding.isCompactConstructor());
- methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[2];
- assertEquals("method name", "abc", methodBinding.getName());
- assertFalse("Is a Constructor?", methodBinding.isConstructor());
- assertFalse("Is a CompactConstructor?", methodBinding.isCompactConstructor());
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
- // Test the code with error doesn't cause a CCE and
- // produces a decent recovered AST
- public void testBug564766() throws JavaModelException {
- if (!isJRE14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
- return;
- }
- String contents =
- "record Foo(int y) {\n" +
- " record Bar(int x) {\n" +
- " public Bar {\n" +
- " c(a.b);\n" +
- " }\n" +
- " }\n" +
- " enum Letter { \n" +
- " A\n" +
- " private Letter { }\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter14/src/Foo.java", true/*resolve*/);
- IJavaProject javaProject = this.workingCopy.getJavaProject();
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
- CompilationUnit compilationUnit = (CompilationUnit) node;
- assertProblemsSize(compilationUnit, 3,
- "a cannot be resolved to a variable\n" +
- "Syntax error on token \"A\", invalid Modifiers\n" +
- "Illegal modifier for the enum constant Letter; no modifier is allowed");
- List types = compilationUnit.types();
- assertEquals("incorrect child elements", 1, types.size());
- RecordDeclaration rec = (RecordDeclaration) types.get(0);
- List bodyDeclarations = rec.bodyDeclarations();
- assertEquals("Incorrect child elements", 2, bodyDeclarations.size());
- node = (ASTNode) bodyDeclarations.get(0);
- assertEquals("Not a compilation unit", ASTNode.RECORD_DECLARATION, node.getNodeType());
- node = (ASTNode) bodyDeclarations.get(1);
- assertEquals("Not a compilation unit", ASTNode.ENUM_DECLARATION, node.getNodeType());
- assertTrue("must be marked as malformed", ((node.getFlags() & ASTNode.MALFORMED) != 0));
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest_15.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest_15.java
new file mode 100644
index 0000000000..664379ed4e
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest_15.java
@@ -0,0 +1,1426 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.dom;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.ArrayType;
+import org.eclipse.jdt.core.dom.Comment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.MemberRef;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodRef;
+import org.eclipse.jdt.core.dom.MethodRefParameter;
+import org.eclipse.jdt.core.dom.ModuleQualifiedName;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextElement;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.IModuleBinding;
+import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
+
+/**
+ * Class to test DOM/AST nodes built for Javadoc comments.
+ *
+ * Most of tests are 'automatic'. It means that to add a new tests, you only need to
+ * create one or several CUs and put them in org.eclipse.jdt.core.model.tests/workspace/Converter/src/javadoc/testXXX
+ * folder and add the corresponding test in this class:
+ * <pre>
+ * public void testXXX() throws JavaModelException {
+ * verifyComments("testXXX");
+ * }
+ * </pre>
+ *
+ * Note that when a test fails, the easiest way to debug it is to open
+ * a runtime workbench, create a project 'Converter', delete the default 'src' source folder
+ * and replace it by a linked source to the 'src' folder of org.eclipse.jdt.core.model.tests/workspace/Converter/src
+ * in your workspace.
+ *
+ * Then open the CU on which the test fails in a ASTView and verify the offset/length
+ * of the offending node located at the positions displayed in the console when the test failed...
+ *
+ * Since 3.4, the failing test also provides the comparison between the source of the comment
+ * and the string get from the built DOM/AST nodes in the comment (see {@link ASTConverterJavadocFlattener})
+ * but this may be not enough to see precisely the origin of the problem.
+ */
+@SuppressWarnings({"rawtypes", "unchecked"})
+public class ASTConverterJavadocTest_15 extends ConverterTestSetup {
+
+ // Flag to know whether Converter directory should be copied from org.eclipse.jdt.core.tests.model project
+ static protected boolean COPY_DIR = true;
+
+ // Test counters
+ protected static int[] TEST_COUNTERS = { 0, 0, 0, 0 };
+ // Unicode tests
+ protected static boolean UNICODE = false;
+ // Unix tests
+ final boolean unix;
+ static final String UNIX_SUPPORT = System.getProperty("unix");
+ // Doc Comment support
+ static final String DOC_COMMENT_SUPPORT = System.getProperty("doc.support");
+ final String docCommentSupport;
+
+ // List of comments read from source of test
+ private static final int LINE_COMMENT = 100;
+ private static final int BLOCK_COMMENT =200;
+ private static final int DOC_COMMENT = 300;
+ List comments = new ArrayList();
+ private String chars;
+ // List of tags contained in each comment read from test source.
+ List allTags = new ArrayList();
+ // tags inhibiting inline tags
+ static final String TAG_CODE = "code";
+ static final String TAG_LITERAL = "literal";
+ // Current compilation unit
+ protected ICompilationUnit sourceUnit;
+ // Test package binding
+ protected boolean resolveBinding = true;
+ protected boolean packageBinding = true;
+ // AST Level
+ protected int astLevel = AST.JLS15;
+ protected int savedLevel;
+ // Debug
+ protected String prefix = "";
+ protected boolean debug = false;
+ protected StringBuffer problems;
+ protected String compilerOption = JavaCore.IGNORE;
+ protected List failures;
+ protected boolean stopOnFailure = true;
+ Map savedOptions = null;
+ protected ICompilationUnit moduleUnit;
+
+
+
+ /**
+ * @param name
+ * @param support
+ */
+ public ASTConverterJavadocTest_15(String name, String support, String unix) {
+ super(name);
+ this.docCommentSupport = support;
+ this.unix = "true".equals(unix);
+ }
+ /**
+ * @param name
+ */
+ public ASTConverterJavadocTest_15(String name) {
+ this(name.substring(0, name.indexOf(" - ")),
+ name.substring(name.indexOf(" - Doc ") + 7, name.lastIndexOf("abled") + 5),
+ name.indexOf(" - Unix") != -1 ? "true" : "false");
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#getName()
+ */
+ public String getName() {
+ String strUnix = this.unix ? " - Unix" : "";
+ return super.getName()+" - Doc "+this.docCommentSupport+strUnix;
+ }
+
+ public static Test suite() {
+ TestSuite suite = new Suite(ASTConverterJavadocTest_15.class.getName());
+// String param = System.getProperty("unicode");
+// if ("true".equals(param)) {
+// unicode = true;
+// }
+// String param = System.getProperty("unix");
+// if ("true".equals(param)) {
+// unix = true;
+// }
+ if (DOC_COMMENT_SUPPORT == null) {
+ buildSuite(suite, JavaCore.ENABLED);
+ buildSuite(suite, JavaCore.DISABLED);
+ } else {
+ String support = DOC_COMMENT_SUPPORT==null ? JavaCore.DISABLED : (DOC_COMMENT_SUPPORT.equals(JavaCore.DISABLED)?JavaCore.DISABLED:JavaCore.ENABLED);
+ buildSuite(suite, support);
+ }
+ return suite;
+
+// Run test cases subset
+// COPY_DIR = false;
+// System.err.println("WARNING: only subset of tests will be executed!!!");
+// suite.addTest(new ASTConverterJavadocTest("testBug165525"));
+// return suite;
+ }
+
+ public static void buildSuite(TestSuite suite, String support) {
+ Class c = ASTConverterJavadocTest_15.class;
+ Method[] methods = c.getMethods();
+ for (int i = 0, max = methods.length; i < max; i++) {
+ if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
+ suite.addTest(new ASTConverterJavadocTest_15(methods[i].getName(), support, UNIX_SUPPORT));
+ }
+ }
+ // when unix support not specified, also run using unix format
+ if (UNIX_SUPPORT == null && JavaCore.ENABLED.equals(support)) {
+ for (int i = 0, max = methods.length; i < max; i++) {
+ if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
+ suite.addTest(new ASTConverterJavadocTest_15(methods[i].getName(), support, "true"));
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.tests.model.AbstractJavaModelTests#copyDirectory(java.io.File, java.io.File)
+ */
+ @Override
+ protected void copyDirectory(File sourceDir, File targetDir) throws IOException {
+ if (COPY_DIR) {
+ super.copyDirectory(sourceDir, targetDir);
+ } else {
+ targetDir.mkdirs();
+ File sourceFile = new File(sourceDir, ".project");
+ File targetFile = new File(targetDir, ".project");
+ targetFile.createNewFile();
+ copy(sourceFile, targetFile);
+ sourceFile = new File(sourceDir, ".classpath");
+ targetFile = new File(targetDir, ".classpath");
+ targetFile.createNewFile();
+ copy(sourceFile, targetFile);
+ }
+ }
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ TEST_COUNTERS[0]++;
+ this.failures = new ArrayList();
+ this.problems = new StringBuffer();
+ this.workingCopies = null;
+ this.savedLevel = this.astLevel;
+ }
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ int size = this.failures.size();
+ String title = size+" positions/bindings were incorrect in "+getName();
+ if (size == 0) {
+ TEST_COUNTERS[1]++;
+ } else if (this.problems.length() > 0) {
+ if (this.debug) {
+ System.out.println("Compilation warnings/errors occured:");
+ System.out.println(this.problems.toString());
+ }
+ TEST_COUNTERS[2]++;
+ } else {
+ TEST_COUNTERS[3]++;
+ System.out.println(title+":");
+ for (int i=0; i<size; i++) {
+ System.out.println(" - "+this.failures.get(i));
+ }
+ }
+// if (!stopOnFailure) {
+ assertTrue(title, size==0 || this.problems.length() > 0);
+// }
+ super.tearDown();
+
+ // Restore saved ast level
+ this.astLevel = this.savedLevel;
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ public void tearDownSuite() throws Exception {
+ // put default options on project
+ if (this.currentProject != null && this.savedOptions != null) {
+ this.currentProject.setOptions(this.savedOptions);
+ }
+ super.tearDownSuite();
+ if (TEST_COUNTERS[0] != TEST_COUNTERS[1]) {
+ NumberFormat intFormat = NumberFormat.getInstance();
+ intFormat.setMinimumIntegerDigits(3);
+ intFormat.setMaximumIntegerDigits(3);
+ System.out.println("=====================================");
+ System.out.println(intFormat.format(TEST_COUNTERS[0])+" tests have been executed:");
+ System.out.println(" - "+intFormat.format(TEST_COUNTERS[1])+" tests have been actually executed.");
+ System.out.println(" - "+intFormat.format(TEST_COUNTERS[2])+" tests were skipped due to compilation errors.");
+ System.out.println(" - "+intFormat.format(TEST_COUNTERS[3])+" tests failed.");
+ }
+ }
+
+ @Override
+ public ASTNode runConversion(char[] source, String unitName, IJavaProject project) {
+ ASTParser parser = ASTParser.newParser(this.astLevel);
+ parser.setSource(source);
+ parser.setUnitName(unitName);
+ parser.setProject(project);
+ parser.setResolveBindings(this.resolveBinding);
+ return parser.createAST(null);
+ }
+
+ @Override
+ public ASTNode runConversion(char[] source, String unitName, IJavaProject project, Map options) {
+ if (project == null) {
+ ASTParser parser = ASTParser.newParser(this.astLevel);
+ parser.setSource(source);
+ parser.setUnitName(unitName);
+ parser.setCompilerOptions(options);
+ parser.setResolveBindings(this.resolveBinding);
+ return parser.createAST(null);
+ }
+ return runConversion(source, unitName, project);
+ }
+
+ private char getNextChar(char[] source, int idx) {
+ // get next char
+ char ch = source[idx];
+ int charLength = 1;
+ int pos = idx;
+ this.chars = null;
+ if (ch == '\\' && source[idx+1] == 'u') {
+ //-------------unicode traitement ------------
+ int c1, c2, c3, c4;
+ charLength++;
+ while (source[idx+charLength] == 'u') charLength++;
+ if (((c1 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c4 < 0)) {
+ return ch;
+ }
+ ch = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+ this.chars = new String(source, pos, charLength);
+ }
+ return ch;
+ }
+ /*
+ * Convert Javadoc source to match Javadoc.toString().
+ * Store converted comments and their corresponding tags respectively
+ * in comments and allTags fields
+ */
+ protected void setSourceComment(char[] source) throws ArrayIndexOutOfBoundsException {
+ this.comments = new ArrayList();
+ this.allTags = new ArrayList();
+ StringBuffer buffer = null;
+ int comment = 0;
+ boolean end = false, lineStarted = false;
+ String tag = null;
+ List tags = new ArrayList();
+ int length = source.length;
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345
+ // when parsing tags such as @code and @literal,
+ // any tag should be discarded and considered as plain text until
+ // properly closed with closing brace
+ boolean considerTagAsPlainText = false;
+ int openingBraces = 0;
+ char previousChar=0, currentChar=0;
+ for (int i=0; i<length;) {
+ previousChar = currentChar;
+ // get next char
+ currentChar = getNextChar(source, i);
+ i += (this.chars==null) ? 1 : this.chars.length();
+
+ switch (comment) {
+ case 0:
+ switch (currentChar) {
+ case '/':
+ comment = 1; // first char for comments...
+ buffer = new StringBuffer();
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ break;
+ case '\'':
+ while (i<length) {
+ // get next char
+ currentChar = getNextChar(source, i);
+ i += (this.chars==null) ? 1 : this.chars.length();
+ if (currentChar == '\\') {
+ // get next char
+ currentChar = getNextChar(source, i);
+ i += (this.chars==null) ? 1 : this.chars.length();
+ } else {
+ if (currentChar == '\'') {
+ break;
+ }
+ }
+ }
+ break;
+ case '"':
+ while (i<length) {
+ // get next char
+ currentChar = getNextChar(source, i);
+ i += (this.chars==null) ? 1 : this.chars.length();
+ if (currentChar == '\\') {
+ // get next char
+ currentChar = getNextChar(source, i);
+ i += (this.chars==null) ? 1 : this.chars.length();
+ } else {
+ if (currentChar == '"') {
+ // get next char
+ currentChar = getNextChar(source, i);
+ if (currentChar == '"') {
+ i += (this.chars==null) ? 1 : this.chars.length();
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ break;
+ case 1: // first '/' has been found...
+ switch (currentChar) {
+ case '/':
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ comment = LINE_COMMENT;
+ break;
+ case '*':
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ comment = 2; // next step
+ break;
+ default:
+ comment = 0;
+ break;
+ }
+ break;
+ case 2: // '/*' has been found...
+ if (currentChar == '*') {
+ comment = 3; // next step...
+ } else {
+ comment = BLOCK_COMMENT;
+ }
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ break;
+ case 3: // '/**' has bee found, verify that's not an empty block comment
+ if (currentChar == '/') { // empty block comment
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ this.comments.add(buffer.toString());
+ this.allTags.add(new ArrayList());
+ comment = 0;
+ break;
+ }
+ comment = DOC_COMMENT;
+ // $FALL-THROUGH$ - do not break, directly go to next case...
+ case DOC_COMMENT:
+ if (tag != null) { // a tag name is currently scanned
+ if (currentChar >= 'a' && currentChar <= 'z') {
+ tag += currentChar;
+ } else {
+ if (tag.equalsIgnoreCase(TAG_LITERAL) || tag.equalsIgnoreCase(TAG_CODE)) considerTagAsPlainText = true;
+ tags.add(tag);
+ tag = null;
+ }
+ }
+ // Some characters are special in javadoc comments
+ switch (currentChar) {
+ case '@':
+ if (!lineStarted) {
+ tag = "";
+ lineStarted = true;
+ } else if (previousChar == '{') {
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345
+ if (considerTagAsPlainText) {
+ openingBraces++;
+ } else {
+ tag = "";
+ lineStarted = true;
+ }
+ }
+ break;
+ case '\r':
+ case '\n':
+ lineStarted = false;
+ break;
+ case '*':
+ break;
+ case '}':
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345
+ if (considerTagAsPlainText) {
+ if (openingBraces > 0) {
+ openingBraces--;
+ } else {
+ considerTagAsPlainText = false;
+ }
+ }
+ break;
+ default:
+ if (!Character.isWhitespace(currentChar)) {
+ lineStarted = true;
+ }
+ }
+ // $FALL-THROUGH$ - common treatment for block and javadoc comments
+ case BLOCK_COMMENT:
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ if (end && currentChar == '/') {
+ comment = 0;
+ lineStarted = false;
+ this.comments.add(buffer.toString());
+ this.allTags.add(tags);
+ tags = new ArrayList();
+ }
+ end = currentChar == '*';
+ break;
+ case LINE_COMMENT:
+ if (currentChar == '\r' || currentChar == '\n') {
+ /*
+ if (currentChar == '\r' && source[i+1] == '\n') {
+ buffer.append(source[++i]);
+ }
+ */
+ comment = 0;
+ this.comments.add(buffer.toString());
+ this.allTags.add(tags);
+ } else {
+ if (this.chars == null) buffer.append(currentChar);
+ else buffer.append(this.chars);
+ }
+ break;
+ default:
+ // do nothing
+ break;
+ }
+ }
+ }
+
+ /*
+ * Convert Javadoc source to match Javadoc.toString().
+ * Store converted comments and their corresponding tags respectively
+ * in comments and allTags fields
+ */
+ char[] getUnicodeSource(char[] source) {
+ int length = source.length;
+ int unicodeLength = length*6;
+ char[] unicodeSource = new char[unicodeLength];
+ int u=0;
+ for (int i=0; i<length; i++) {
+ // get next char
+ if (source[i] == '\\' && source[i+1] == 'u') {
+ //-------------unicode traitement ------------
+ int c1, c2, c3, c4;
+ unicodeSource[u++] = source[i];
+ unicodeSource[u++] = source[++i];
+ if (((c1 = ScannerHelper.getHexadecimalValue(source[i+1])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(source[i+2])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(source[i+3])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(source[i+4])) > 15 || c4 < 0)) {
+ throw new RuntimeException("Invalid unicode in source at "+i);
+ }
+ for (int j=0; j<4; j++) unicodeSource[u++] = source[++i];
+ } else {
+ unicodeSource[u++] = '\\';
+ unicodeSource[u++] = 'u';
+ unicodeSource[u++] = '0';
+ unicodeSource[u++] = '0';
+ int val = source[i]/16;
+ unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61);
+ val = source[i]%16;
+ unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61);
+ }
+ }
+ // Return one well sized array
+ if (u != unicodeLength) {
+ char[] result = new char[u];
+ System.arraycopy(unicodeSource, 0, result, 0, u);
+ return result;
+ }
+ return unicodeSource;
+ }
+
+ /*
+ * Convert Javadoc source to match Javadoc.toString().
+ * Store converted comments and their corresponding tags respectively
+ * in comments and allTags fields
+ */
+ char[] getUnixSource(char[] source) {
+ int length = source.length;
+ int unixLength = length;
+ char[] unixSource = new char[unixLength];
+ int u=0;
+ for (int i=0; i<length; i++) {
+ // get next char
+ if (source[i] == '\r' && source[i+1] == '\n') {
+ i++;
+ }
+ unixSource[u++] = source[i];
+ }
+ // Return one well sized array
+ if (u != unixLength) {
+ char[] result = new char[u];
+ System.arraycopy(unixSource, 0, result, 0, u);
+ return result;
+ }
+ return unixSource;
+ }
+
+ /*
+ * Return all tags number for a given Javadoc
+ */
+ int allTags(Javadoc docComment) {
+ int all = 0;
+ // Count main tags
+ Iterator tags = docComment.tags().listIterator();
+ while (tags.hasNext()) {
+ TagElement tagElement = (TagElement) tags.next();
+ if (tagElement.getTagName() != null) {
+ all++;
+ }
+ Iterator fragments = tagElement.fragments().listIterator();
+ while (fragments.hasNext()) {
+ ASTNode node = (ASTNode) fragments.next();
+ if (node.getNodeType() == ASTNode.TAG_ELEMENT) {
+ all++;
+ }
+ }
+ }
+ return all;
+ }
+
+ /*
+ * Add a failure to the list. Use only one method as it easier to put breakpoint to
+ * debug failure when it occurs...
+ */
+ private void addFailure(String msg) {
+ this.failures.add(msg);
+ }
+
+ /*
+ * Put the failure message in list instead of throwing exception immediately.
+ * This allow to store several failures per test...
+ * @see tearDown method which finally throws the execption to signal that test fails.
+ */
+ protected void assumeTrue(String msg, boolean cond) {
+ if (!cond) {
+ addFailure(msg);
+ if (this.stopOnFailure) assertTrue(msg, cond);
+ }
+ }
+
+ /*
+ * Put the failure message in list instead of throwing exception immediately.
+ * This allow to store several failures per test...
+ * @see tearDown method which finally throws the execption to signal that test fails.
+ */
+ protected void assumeNull(String msg, Object obj) {
+ if (obj != null) {
+ addFailure(msg);
+ if (this.stopOnFailure) assertNull(msg, obj);
+ }
+ }
+
+ /*
+ * Put the failure message in list instead of throwing exception immediately.
+ * This allow to store several failures per test...
+ * @see tearDown method which finally throws the execption to signal that test fails.
+ */
+ protected void assumeNotNull(String msg, Object obj) {
+ if (obj == null) {
+ addFailure(msg);
+ if (this.stopOnFailure) assertNotNull(msg, obj);
+ }
+ }
+
+ /*
+ * Put the failure message in list instead of throwing exception immediately.
+ * This allow to store several failures per test...
+ * @see tearDown method which finally throws the execption to signal that test fails.
+ */
+ protected void assumeEquals(String msg, int expected, int actual) {
+ if (expected != actual) {
+ addFailure(msg+", expected="+expected+" actual="+actual);
+ if (this.stopOnFailure) assertEquals(msg, expected, actual);
+ }
+ }
+
+ /*
+ * Put the failure message in list instead of throwing exception immediately.
+ * This allow to store several failures per test...
+ * @see tearDown method which finally throws the execption to signal that test fails.
+ */
+ protected void assumeEquals(String msg, Object expected, Object actual) {
+ if (expected == null && actual == null)
+ return;
+ if (expected != null && expected.equals(actual))
+ return;
+ addFailure(msg+", expected:<"+expected+"> actual:<"+actual+'>');
+ if (this.stopOnFailure) assertEquals(msg, expected, actual);
+ }
+
+ /*
+ * Verify positions of tags in source
+ */
+ private void verifyPositions(Javadoc docComment, char[] source) {
+ boolean stop = this.stopOnFailure;
+ this.stopOnFailure = false;
+ // Verify javadoc start and end position
+ int start = docComment.getStartPosition();
+ int end = start+docComment.getLength()-1;
+ assumeTrue(this.prefix+"Misplaced javadoc start at <"+start+">: "+docComment, source[start++] == '/' && source[start++] == '*' && source[start++] == '*');
+ // Get first meaningful character
+ int tagStart = start;
+ // Verify tags
+ Iterator tags = docComment.tags().listIterator();
+ while (tags.hasNext()) {
+ while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
+ tagStart++; // purge non-stored characters
+ }
+ TagElement tagElement = (TagElement) tags.next();
+ int teStart = tagElement.getStartPosition();
+ assumeEquals(this.prefix+"Wrong start position <"+teStart+"> for tag element: "+tagElement, tagStart, teStart);
+ verifyPositions(tagElement, source);
+ tagStart += tagElement.getLength();
+ }
+ while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
+ tagStart++; // purge non-stored characters
+ }
+ assumeTrue(this.prefix+"Misplaced javadoc end at <"+tagStart+'>', source[tagStart-1] == '*' && source[tagStart] == '/');
+ assumeEquals(this.prefix+"Wrong javadoc length at <"+end+">: ", tagStart, end);
+ this.stopOnFailure = stop;
+ if (stop && this.failures.size() > 0) {
+ String expected = new String(source, docComment.getStartPosition(), docComment.getLength());
+ ASTConverterJavadocFlattener flattener = new ASTConverterJavadocFlattener(expected);
+ docComment.accept(flattener);
+ assertEquals("Unexpected errors while verifying javadoc comment positions!", expected, flattener.getResult());
+ }
+ }
+
+ /**
+ * Verify positions of fragments in source
+ * @deprecated using deprecated code
+ */
+ private void verifyPositions(TagElement tagElement, char[] source) {
+ String text = null;
+ // Verify tag name
+ String tagName = tagElement.getTagName();
+ int tagStart = tagElement.getStartPosition();
+ if (tagElement.isNested()) {
+ assumeEquals(this.prefix+"Wrong start position <"+tagStart+"> for "+tagElement, '{', source[tagStart++]);
+ }
+ if (tagName != null) {
+ text= new String(source, tagStart, tagName.length());
+ assumeEquals(this.prefix+"Misplaced tag name at <"+tagStart+">: ", tagName, text);
+ tagStart += tagName.length();
+ }
+ // Verify each fragment
+ ASTNode previousFragment = null;
+ Iterator elements = tagElement.fragments().listIterator();
+ while (elements.hasNext()) {
+ ASTNode fragment = (ASTNode) elements.next();
+ if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
+ if (previousFragment == null && TagElement.TAG_PARAM.equals(tagName) && ((TextElement)fragment).getText().equals("<")) { // special case here for @param <E> syntax
+ int start = tagStart;
+ // verify '<'
+ while (source[start] == ' ' || Character.isWhitespace(source[start])) {
+ start++; // purge white characters
+ }
+ text = new String(source, start, fragment.getLength());
+ assumeEquals(this.prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText());
+ start += fragment.getLength();
+ // verify simple name
+ assumeTrue(this.prefix+"Unexpected fragment end for "+tagElement, elements.hasNext());
+ fragment = (ASTNode) elements.next();
+ while (source[start] == ' ' || Character.isWhitespace(source[start])) {
+ start++; // purge white characters
+ }
+ assumeEquals(this.prefix+"Unexpected node type for tag element "+tagElement, ASTNode.SIMPLE_NAME, fragment.getNodeType());
+ Name name = (Name) fragment;
+ verifyNamePositions(start, name, source);
+ start += fragment.getLength();
+ // verify simple name
+ assumeTrue(this.prefix+"Unexpected fragment end for "+tagElement, elements.hasNext());
+ fragment = (ASTNode) elements.next();
+ while (source[start] == ' ' || Character.isWhitespace(source[start])) {
+ start++; // purge white characters
+ }
+ text = new String(source, start, fragment.getLength());
+ assumeEquals(this.prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText());
+ start += fragment.getLength();
+ // reset fragment as simple name to avoid issue with next text element
+ fragment = name;
+ tagStart += (start- tagStart) - name.getLength();
+ } else {
+ if (previousFragment == null) {
+ if (tagName != null && (source[tagStart] == '\r' || source[tagStart] == '\n')) {
+ while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
+ tagStart++; // purge non-stored characters
+ }
+ }
+ } else {
+ if (previousFragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
+ assumeTrue(this.prefix+"Wrong length at <"+previousFragment.getStartPosition()+"> for text element "+previousFragment, (source[tagStart] == '\r' /* && source[tagStart+1] == '\n' */ || source[tagStart] == '\n'));
+ while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
+ tagStart++; // purge non-stored characters
+ }
+ } else if (TagElement.TAG_PARAM.equals(tagName) && previousFragment.getNodeType() == ASTNode.SIMPLE_NAME && ((TextElement)fragment).getText().equals(">")) {
+ while (source[tagStart] == ' ' || Character.isWhitespace(source[tagStart])) {
+ tagStart++; // purge white characters
+ }
+ } else {
+ int start = tagStart;
+ boolean newLine = false;
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ if (source[tagStart] == '\r' || source[tagStart] == '\n') {
+ newLine = true;
+ }
+ }
+ if (newLine) tagStart = start;
+ }
+ }
+ text = new String(source, tagStart, fragment.getLength());
+ assumeEquals(this.prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText());
+ }
+ } else {
+ while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
+ tagStart++; // purge non-stored characters
+ }
+ if (fragment.getNodeType() == ASTNode.SIMPLE_NAME || fragment.getNodeType() == ASTNode.QUALIFIED_NAME) {
+ verifyNamePositions(tagStart, (Name) fragment, source);
+ } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) {
+ TagElement inlineTag = (TagElement) fragment;
+ assumeEquals(this.prefix+"Tag element <"+inlineTag+"> has wrong start position", tagStart, inlineTag.getStartPosition());
+ verifyPositions(inlineTag, source);
+ } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) {
+ MemberRef memberRef = (MemberRef) fragment;
+ // Store start position
+ int start = tagStart;
+ // Verify qualifier position
+ Name qualifier = memberRef.getQualifier();
+ if (qualifier != null) {
+ verifyNamePositions(start, qualifier, source);
+ start += qualifier.getLength();
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ }
+ // Verify member separator position
+ assumeEquals(this.prefix+"Misplaced # separator at <"+start+"> for member ref "+memberRef, '#', source[start]);
+ start++;
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ // Verify member name position
+ Name name = memberRef.getName();
+ text = new String(source, start, name.getLength());
+ assumeEquals(this.prefix+"Misplaced member ref at <"+start+">: ", text, name.toString());
+ verifyNamePositions(start, name, source);
+ } else if (fragment.getNodeType() == ASTNode.METHOD_REF) {
+ MethodRef methodRef = (MethodRef) fragment;
+ // Store start position
+ int start = tagStart;
+ // Verify qualifier position
+ Name qualifier = methodRef.getQualifier();
+ if (qualifier != null) {
+ verifyNamePositions(start, qualifier, source);
+ start += qualifier.getLength();
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ }
+ // Verify member separator position
+ assumeEquals(this.prefix+"Misplaced # separator at <"+start+"> for method ref: "+methodRef, '#', source[start]);
+ start++;
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ // Verify member name position
+ Name name = methodRef.getName();
+ int nameLength = name.getLength();
+ text = new String(source, start, nameLength);
+ if (!text.equals(name.toString())) { // may have qualified constructor reference for inner classes
+ if (methodRef.getQualifier().isQualifiedName()) {
+ text = new String(source, start, methodRef.getQualifier().getLength());
+ assumeEquals(this.prefix+"Misplaced method ref name at <"+start+">: ", text, methodRef.getQualifier().toString());
+ while (source[start] != '.' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ start++;
+ } else {
+ while (source[start] != '.' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ start++;
+ text = new String(source, start, nameLength);
+ assumeEquals(this.prefix+"Misplaced method ref name at <"+start+">: ", text, name.toString());
+ }
+ }
+ verifyNamePositions(start, name, source);
+ start += nameLength;
+ // Verify arguments starting open parenthesis
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+// assumeEquals(prefix+"Misplaced ( at <"+start+"> for method ref: "+methodRef, '(', source[start]);
+ if (source[start] == '(') { // now method reference may have no parenthesis...
+ start++;
+ // Verify parameters
+ Iterator parameters = methodRef.parameters().listIterator();
+ while (parameters.hasNext()) {
+ MethodRefParameter param = (MethodRefParameter) parameters.next();
+ boolean lastParam = !parameters.hasNext();
+ // Verify parameter type positions
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++; // purge non-stored characters
+ }
+ Type type = param.getType();
+ if (type.isSimpleType()) {
+ verifyNamePositions(start, ((SimpleType)type).getName(), source);
+ } else if (type.isPrimitiveType()) {
+ text = new String(source, start, type.getLength());
+ assumeEquals(this.prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, type.toString());
+ } else if (type.isArrayType()) {
+ Type elementType = ((ArrayType) param.getType()).getElementType();
+ if (elementType.isSimpleType()) {
+ verifyNamePositions(start, ((SimpleType)elementType).getName(), source);
+ } else if (elementType.isPrimitiveType()) {
+ text = new String(source, start, elementType.getLength());
+ assumeEquals(this.prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, elementType.toString());
+ }
+ }
+ start += type.getLength();
+ // if last param then perhaps a varargs
+ while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration
+ start++; // purge non-stored characters
+ }
+ if (lastParam && this.astLevel != AST.JLS2 && param.isVarargs()) {
+ for (int p=0;p<3;p++) {
+ assumeTrue(this.prefix+"Missing ellipsis for vararg method ref parameter at <"+start+"> for method ref: "+methodRef, source[start++]=='.');
+ }
+ }
+ // Verify parameter name positions
+ while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration
+ start++; // purge non-stored characters
+ }
+ name = param.getName();
+ if (name != null) {
+ text = new String(source, start, name.getLength());
+ assumeEquals(this.prefix+"Misplaced method ref parameter name at <"+start+"> for method ref: "+methodRef, text, name.toString());
+ start += name.getLength();
+ }
+ // Verify end parameter declaration
+ while (source[start] == '*' || Character.isWhitespace(source[start])) {
+ start++;
+ }
+ assumeTrue(this.prefix+"Misplaced parameter end at <"+start+"> for method ref: "+methodRef, source[start] == ',' || source[start] == ')');
+ start++;
+ if (source[start] == ')') {
+ break;
+ }
+ }
+ }
+ }
+ }
+ tagStart += fragment.getLength();
+ previousFragment = fragment;
+ }
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206345
+ if (!(TAG_CODE.equalsIgnoreCase(tagName) || !TAG_LITERAL.equalsIgnoreCase(tagName)) && tagElement.isNested()) {
+ assumeEquals(this.prefix+"Wrong end character at <"+tagStart+"> for "+tagElement, '}', source[tagStart++]);
+ }
+ }
+
+ /*
+ * Verify each name component positions.
+ */
+ private void verifyNamePositions(int nameStart, Name name, char[] source) {
+ if (name.isQualifiedName()) {
+ QualifiedName qualified = (QualifiedName) name;
+ int start = qualified.getName().getStartPosition();
+ String str = new String(source, start, qualified.getName().getLength());
+ assumeEquals(this.prefix+"Misplaced or wrong name for qualified name: "+name, str, qualified.getName().toString());
+ verifyNamePositions(nameStart, ((QualifiedName) name).getQualifier(), source);
+ }
+ String str = new String(source, nameStart, name.getLength());
+ if (str.indexOf('\n') < 0) { // cannot compare if text contains new line
+ assumeEquals(this.prefix+"Misplaced name for qualified name: ", str, name.toString());
+ } else if (this.debug) {
+ System.out.println(this.prefix+"Name contains new line for qualified name: "+name);
+ }
+ }
+
+ /*
+ * Verify that bindings of Javadoc comment structure are resolved or not.
+ * For expected unresolved binding, verify that following text starts with 'Unknown'
+ */
+ private void verifyBindings(Javadoc docComment) {
+ boolean stop = this.stopOnFailure;
+// stopOnFailure = false;
+ // Verify tags
+ Iterator tags = docComment.tags().listIterator();
+ while (tags.hasNext()) {
+ verifyBindings((TagElement) tags.next());
+ }
+ this.stopOnFailure = stop;
+ assertTrue(!stop || this.failures.size()==0);
+ }
+
+ /*
+ * Verify that bindings of Javadoc tag structure are resolved or not.
+ * For expected unresolved binding, verify that following text starts with 'Unknown'
+ */
+ private void verifyBindings(TagElement tagElement) {
+ // Verify each fragment
+ Iterator elements = tagElement.fragments().listIterator();
+ IBinding previousBinding = null;
+ ASTNode previousFragment = null;
+ boolean resolvedBinding = false;
+ while (elements.hasNext()) {
+ ASTNode fragment = (ASTNode) elements.next();
+ if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
+ TextElement text = (TextElement) fragment;
+ if (resolvedBinding) {
+ if (previousBinding == null) {
+ assumeTrue(this.prefix+"Reference '"+previousFragment+"' should be bound!", text.getText().trim().indexOf("Unknown")>=0);
+ } else {
+ assumeTrue(this.prefix+"Unknown reference '"+previousFragment+"' should NOT be bound!", text.getText().trim().indexOf("Unknown")<0);
+ }
+ }
+ previousBinding = null;
+ resolvedBinding = false;
+ } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) {
+ verifyBindings((TagElement) fragment);
+ previousBinding = null;
+ resolvedBinding = false;
+ } else {
+ resolvedBinding = true;
+ if (fragment.getNodeType() == ASTNode.SIMPLE_NAME) {
+ previousBinding = ((Name)fragment).resolveBinding();
+ } else if (fragment.getNodeType() == ASTNode.QUALIFIED_NAME) {
+ QualifiedName name = (QualifiedName) fragment;
+ previousBinding = name.resolveBinding();
+ verifyNameBindings(name);
+ } else if (fragment.getNodeType() == ASTNode.MODULE_QUALIFIED_NAME) {
+ ModuleQualifiedName name = (ModuleQualifiedName) fragment;
+ Name typeName = name.getName();
+ if (typeName != null) {
+ if (typeName.getNodeType() == ASTNode.SIMPLE_NAME) {
+ previousBinding = ((Name)fragment).resolveBinding();
+ } else if (typeName.getNodeType() == ASTNode.QUALIFIED_NAME) {
+ QualifiedName qname = (QualifiedName) typeName;
+ previousBinding = qname.resolveBinding();
+ verifyNameBindings(qname);
+ }
+ }
+ Name mName = name.getModuleQualifier();
+ if (mName.getNodeType() == ASTNode.SIMPLE_NAME) {
+ previousBinding = ((Name)fragment).resolveBinding();
+ } else if (mName.getNodeType() == ASTNode.QUALIFIED_NAME) {
+ QualifiedName qname = (QualifiedName) mName;
+ previousBinding = qname.resolveBinding();
+ }
+ assumeNotNull(this.prefix+""+name+" binding was not foundfound in "+fragment, previousBinding);
+ assumeTrue(this.prefix+""+name+" binding is not module binding "+fragment, previousBinding instanceof IModuleBinding);
+ } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) {
+ MemberRef memberRef = (MemberRef) fragment;
+ previousBinding = memberRef.resolveBinding();
+ if (previousBinding != null) {
+ SimpleName name = memberRef.getName();
+ assumeNotNull(this.prefix+""+name+" binding was not foundfound in "+fragment, name.resolveBinding());
+ verifyNameBindings(memberRef.getQualifier());
+ }
+ } else if (fragment.getNodeType() == ASTNode.METHOD_REF) {
+ MethodRef methodRef = (MethodRef) fragment;
+ previousBinding = methodRef.resolveBinding();
+ if (previousBinding != null) {
+ SimpleName methodName = methodRef.getName();
+ IBinding methNameBinding = methodName.resolveBinding();
+ Name methodQualifier = methodRef.getQualifier();
+ // TODO (frederic) Replace the two following lines by commented block when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650 will be fixed
+ assumeNotNull(this.prefix+""+methodName+" binding was not found in "+fragment, methNameBinding);
+ verifyNameBindings(methodQualifier);
+ /*
+ if (methodQualifier == null) {
+ if (methNameBinding == null) {
+ char firstChar = methodName.getIdentifier().charAt(0);
+ if (Character.isUpperCase(firstChar)) {
+ // assume that selector starting with uppercase is for constructor => signal that binding is null
+ System.out.println(prefix+"Binding for selector of '"+methodRef+"' is null.");
+ }
+ } else {
+ if (methNameBinding.getName().equals(methodName.getIdentifier())) { // binding is not null only for constructor
+ assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding);
+ } else {
+ assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding);
+ }
+ }
+ } else {
+ SimpleName methodSimpleType = null;
+ if (methodQualifier.isQualifiedName()) {
+ methodSimpleType = ((QualifiedName)methodQualifier).getName();
+ } else {
+ methodSimpleType = (SimpleName) methodQualifier;
+ }
+ if (methodSimpleType.getIdentifier().equals(methodName.getIdentifier())) { // binding is not null only for constructor
+ assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding);
+ } else {
+ assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding);
+ }
+ verifyNameBindings(methodRef.getQualifier());
+ }
+ */
+ Iterator parameters = methodRef.parameters().listIterator();
+ while (parameters.hasNext()) {
+ MethodRefParameter param = (MethodRefParameter) parameters.next();
+ Type type = param.getType();
+ assumeNotNull(this.prefix+""+type+" binding was not found in "+fragment, type.resolveBinding());
+ if (type.isSimpleType()) {
+ verifyNameBindings(((SimpleType)type).getName());
+ } else if (type.isArrayType()) {
+ Type elementType = ((ArrayType) param.getType()).getElementType();
+ assumeNotNull(this.prefix+""+elementType+" binding was not found in "+fragment, elementType.resolveBinding());
+ if (elementType.isSimpleType()) {
+ verifyNameBindings(((SimpleType)elementType).getName());
+ }
+ }
+ // Do not verify parameter name as no binding is expected for them
+ }
+ }
+ }
+ }
+ previousFragment = fragment;
+ }
+ assumeTrue(this.prefix+"Reference '"+(previousFragment==null?tagElement:previousFragment)+"' should be bound!", (!resolvedBinding || previousBinding != null));
+ }
+
+ /*
+ * Verify each name component binding.
+ */
+ private void verifyNameBindings(Name name) {
+ if (name != null) {
+ IBinding binding = name.resolveBinding();
+ if (name.toString().indexOf("Unknown") > 0) {
+ assumeNull(this.prefix+name+" binding should be null!", binding);
+ } else {
+ assumeNotNull(this.prefix+name+" binding was not found!", binding);
+ }
+ SimpleName simpleName = null;
+ int index = 0;
+ while (name.isQualifiedName()) {
+ simpleName = ((QualifiedName) name).getName();
+ binding = simpleName.resolveBinding();
+ if (simpleName.getIdentifier().equalsIgnoreCase("Unknown")) {
+ assumeNull(this.prefix+simpleName+" binding should be null!", binding);
+ } else {
+ assumeNotNull(this.prefix+simpleName+" binding was not found!", binding);
+ }
+ if (index > 0 && this.packageBinding) {
+ assumeEquals(this.prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind());
+ }
+ index++;
+ name = ((QualifiedName) name).getQualifier();
+ binding = name.resolveBinding();
+ if (name.toString().indexOf("Unknown") > 0) {
+ assumeNull(this.prefix+name+" binding should be null!", binding);
+ } else {
+ assumeNotNull(this.prefix+name+" binding was not found!", binding);
+ }
+ if (this.packageBinding) {
+ assumeEquals(this.prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind());
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void verifyComments(String test) throws JavaModelException {
+ ICompilationUnit[] units = getCompilationUnits("Converter" , "src", "javadoc."+test); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ for (int i=0; i<units.length; i++) {
+ verifyComments(units[i]);
+ }
+ }
+
+ /*
+ * Verify the comments of a compilation unit.
+ */
+ protected void verifyWorkingCopiesComments() throws JavaModelException {
+ assumeNotNull("No working copies to verify!", this.workingCopies);
+ int length = this.workingCopies.length;
+ assumeTrue("We need to have at least one working copy to verify!", length>0);
+ for (int i=0; i<length; i++) {
+ verifyComments(this.workingCopies[i]);
+ }
+ }
+
+ /*
+ * Verify the comments of a compilation unit.
+ */
+ protected CompilationUnit verifyComments(ICompilationUnit unit) throws JavaModelException {
+ // Get test file
+ this.sourceUnit = unit;
+ this.prefix = unit.getElementName()+": ";
+
+ // Get current project
+ String sourceStr = this.sourceUnit.getSource();
+ if (this.savedOptions != null && !this.sourceUnit.getJavaProject().getElementName().equals(this.currentProject.getElementName())) {
+ this.currentProject.setOptions(this.savedOptions);
+ this.savedOptions = null;
+ }
+ this.currentProject = this.sourceUnit.getJavaProject();
+ if (this.savedOptions == null) this.savedOptions = this.currentProject.getOptions(false);
+
+ // set up java project options
+ this.currentProject.setOption(JavaCore.COMPILER_PB_INVALID_JAVADOC, this.compilerOption);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, this.compilerOption);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, this.compilerOption);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, JavaCore.IGNORE);
+ this.currentProject.setOption(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, this.docCommentSupport);
+
+ // Verify source regardings converted comments
+ char[] source = sourceStr.toCharArray();
+ String fileName = unit.getPath().toString();
+ try {
+ return verifyComments(fileName, source);
+ }
+ catch (RuntimeException ex) {
+ TEST_COUNTERS[3]++;
+ throw ex;
+ }
+ }
+
+ protected CompilationUnit verifyComments(String fileName, char[] source) {
+ return verifyComments(fileName, source, null);
+ }
+
+ protected CompilationUnit verifyComments(String fileName, char[] source, Map options) {
+
+ // Verify comments either in unicode or not
+ char[] testedSource = source;
+ if (UNICODE) {
+ testedSource = getUnicodeSource(source);
+ }
+
+ // Verify comments either in unicode or not
+ else if (this.unix) {
+ testedSource = getUnixSource(source);
+ }
+
+ // Get comments infos from test file
+ setSourceComment(testedSource);
+
+ // Create DOM AST nodes hierarchy
+ List unitComments = null;
+ String sourceLevel = null;
+ String complianceLevel = null;
+ if (this.currentProject != null) {
+ complianceLevel = this.currentProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ sourceLevel = this.currentProject.getOption(JavaCore.COMPILER_SOURCE, true);
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ }
+ CompilationUnit compilUnit = (CompilationUnit) runConversion(testedSource, fileName, this.currentProject, options);
+ if (this.compilerOption.equals(JavaCore.ERROR)) {
+ assumeEquals(this.prefix+"Unexpected problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
+ } else if (this.compilerOption.equals(JavaCore.WARNING)) {
+ IProblem[] problemsList = compilUnit.getProblems();
+ int length = problemsList.length;
+ if (length > 0) {
+ this.problems.append(" - "+this.prefix+length+" problems:"); //$NON-NLS-1$
+ for (int i = 0; i < problemsList.length; i++) {
+ this.problems.append(" + ");
+ this.problems.append(problemsList[i]);
+ this.problems.append("\n");
+ }
+ }
+ }
+ unitComments = compilUnit.getCommentList();
+ assumeNotNull(this.prefix+"Unexpected problems", unitComments);
+
+ // Basic comments verification
+ int size = unitComments.size();
+ assumeEquals(this.prefix+"Wrong number of comments!", this.comments.size(), size);
+
+ // Verify comments positions and bindings
+ for (int i=0; i<size; i++) {
+ Comment comment = (Comment) unitComments.get(i);
+ List tags = (List) this.allTags.get(i);
+ // Verify flattened content
+ String stringComment = (String) this.comments.get(i);
+// ASTConverterJavadocFlattener printer = new ASTConverterJavadocFlattener(stringComment);
+// comment.accept(printer);
+ String text = new String(testedSource, comment.getStartPosition(), comment.getLength());
+ assumeEquals(this.prefix+"Flattened comment does NOT match source!", stringComment, text);
+ // Verify javdoc tags positions and bindings
+ if (comment.isDocComment()) {
+ Javadoc docComment = (Javadoc)comment;
+ if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
+ assumeEquals(this.prefix+"Invalid tags number in javadoc:\n"+docComment+"\n", tags.size(), allTags(docComment));
+ verifyPositions(docComment, testedSource);
+ if (this.resolveBinding) {
+ verifyBindings(docComment);
+ }
+ } else {
+ assumeEquals("Javadoc should be flat!", 0, docComment.tags().size());
+ }
+ }
+ }
+
+ /* Verify each javadoc: not implemented yet
+ Iterator types = compilUnit.types().listIterator();
+ while (types.hasNext()) {
+ TypeDeclaration typeDeclaration = (TypeDeclaration) types.next();
+ verifyJavadoc(typeDeclaration.getJavadoc());
+ }
+ */
+
+ if (sourceLevel != null) {
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, complianceLevel);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, sourceLevel);
+ }
+ // Return compilation unit for possible further verifications
+ return compilUnit;
+ }
+
+ public void testJavadoc1() throws JavaModelException {
+ this.moduleUnit = getWorkingCopy("/Converter_15_1/src/module-info.java",
+ "module test1.one.two {\r\n" +
+ "}");
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Converter_15_1/src/javadoc/X.java",
+ "package javadoc;\n" +
+ "public class X {\n" +
+ " /** \n" +
+ " * @see test1.one.two/ \n" +
+ " * {@link test1.one.two/} \n" +
+ " * {@linkplain test1.one.two/} \n" +
+ " */ \n" +
+ " public static void foo(Object object) {\n" +
+ " }\n" +
+ "}\n"
+ );
+ CompilationUnit compilUnit = verifyComments(this.workingCopies[0]);
+ if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
+ // Get comments
+ List unitComments = compilUnit.getCommentList();
+ int size = unitComments.size();
+ assertEquals("Wrong number of comments", 1, size);
+ Javadoc[] javadocs = new Javadoc[size];
+ Iterator iterator = unitComments.iterator();
+ for (int i=0; i<size; i++) {
+ Comment comment = (Comment) iterator.next();
+ assertEquals("Expect javadoc for comment: "+comment, ASTNode.JAVADOC, comment.getNodeType());
+ javadocs[i] = (Javadoc) comment;
+ }
+
+ // Verify member type declaration start
+ ASTNode node = getASTNode(compilUnit, 0, 0);
+ assertEquals("Expected method declaration for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
+ MethodDeclaration methodDeclaration = (MethodDeclaration) node;
+ int javadocStart = javadocs[0].getStartPosition();
+ assertEquals("Invalid start position for MethodDeclaration: "+methodDeclaration, methodDeclaration.getStartPosition(), javadocStart);
+ }
+ }
+
+ public void testJavadoc3() throws JavaModelException {
+ this.moduleUnit = getWorkingCopy("/Converter_15_1/src/module-info.java",
+ "module test1.one.two {\r\n" +
+ "}");
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Converter_15_1/src/javadoc/X.java",
+ "package javadoc;\n" +
+ "public class X {\n" +
+ " /** \n" +
+ " * @see test1.one.two/javadoc.X#foo \n" +
+ " */ \n" +
+ " public static void foo(Object object) {\n" +
+ " }\n" +
+ "}\n"
+ );
+ CompilationUnit compilUnit = verifyComments(this.workingCopies[0]);
+ if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
+ // Get comments
+ List unitComments = compilUnit.getCommentList();
+ int size = unitComments.size();
+ assertEquals("Wrong number of comments", 1, size);
+ Javadoc[] javadocs = new Javadoc[size];
+ Iterator iterator = unitComments.iterator();
+ for (int i=0; i<size; i++) {
+ Comment comment = (Comment) iterator.next();
+ assertEquals("Expect javadoc for comment: "+comment, ASTNode.JAVADOC, comment.getNodeType());
+ javadocs[i] = (Javadoc) comment;
+ }
+
+ // Verify member type declaration start
+ ASTNode node = getASTNode(compilUnit, 0, 0);
+ assertEquals("Expected method declaration for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
+ MethodDeclaration methodDeclaration = (MethodDeclaration) node;
+ int javadocStart = javadocs[0].getStartPosition();
+ assertEquals("Invalid start position for MethodDeclaration: "+methodDeclaration, methodDeclaration.getStartPosition(), javadocStart);
+ }
+ }
+
+ public void testJavadoc2() throws JavaModelException {
+ this.moduleUnit = getWorkingCopy("/Converter_15_1/src/module-info.java",
+ "module test1.one.two {\r\n" +
+ "}");
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Converter_15_1/src/javadoc/X.java",
+ "package javadoc;\n" +
+ "public class X {\n" +
+ " /** \n" +
+ " * @see test1.one.two/javadoc.X \n" +
+ " */ \n" +
+ " public static void foo(Object object) {\n" +
+ " }\n" +
+ "}\n"
+ );
+ CompilationUnit compilUnit = verifyComments(this.workingCopies[0]);
+ if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
+ // Get comments
+ List unitComments = compilUnit.getCommentList();
+ int size = unitComments.size();
+ assertEquals("Wrong number of comments", 1, size);
+ Javadoc[] javadocs = new Javadoc[size];
+ Iterator iterator = unitComments.iterator();
+ for (int i=0; i<size; i++) {
+ Comment comment = (Comment) iterator.next();
+ assertEquals("Expect javadoc for comment: "+comment, ASTNode.JAVADOC, comment.getNodeType());
+ javadocs[i] = (Javadoc) comment;
+ }
+
+ // Verify member type declaration start
+ ASTNode node = getASTNode(compilUnit, 0, 0);
+ assertEquals("Expected method declaration for node: "+node, ASTNode.METHOD_DECLARATION, node.getNodeType());
+ MethodDeclaration methodDeclaration = (MethodDeclaration) node;
+ int javadocStart = javadocs[0].getStartPosition();
+ assertEquals("Invalid start position for MethodDeclaration: "+methodDeclaration, methodDeclaration.getStartPosition(), javadocStart);
+ }
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_15Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_15Test.java
new file mode 100644
index 0000000000..99fab78438
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_15Test.java
@@ -0,0 +1,1126 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.dom;
+
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.InstanceofExpression;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.TextBlock;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+
+import junit.framework.Test;
+
+@SuppressWarnings("rawtypes")
+public class ASTConverter_15Test extends ConverterTestSetup {
+
+ ICompilationUnit workingCopy;
+ //private static final String jclLib = "CONVERTER_JCL15_LIB";
+
+ public void setUpSuite() throws Exception {
+ super.setUpSuite();
+ this.ast = AST.newAST(getAST15(), false);
+ if (this.ast.apiLevel() == AST.JLS15 ) {
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ }
+ }
+
+ public ASTConverter_15Test(String name) {
+ super(name);
+ }
+
+ static {
+// TESTS_NUMBERS = new int[] { 19 };
+// TESTS_RANGE = new int[] { 1, -1 };
+// TESTS_NAMES = new String[] {"test0001"};
+ }
+ public static Test suite() {
+ return buildModelTestSuite(ASTConverter_15Test.class);
+ }
+
+ static int getAST15() {
+ return AST.JLS15;
+ }
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (this.workingCopy != null) {
+ this.workingCopy.discardWorkingCopy();
+ this.workingCopy = null;
+ }
+ }
+
+ public void testRecord001() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public record X() {\n" +
+ " public X {\n" +
+ " System.out.println(\"no error\");\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ /**
+ * Added for Bug 561193 - [14]record keyword inside method not colored correctly
+ * @throws CoreException
+ */
+ public void testRecord002() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public record X(int param1, int param2) {\n" +
+ " public X {\n" +
+ " if (param1 > 5) {\n" +
+ " System.out.println(\"error\");\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord003() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public record X(int param1, int param2) {\n" +
+ " public X {\n" +
+ " if (param1 > 5) {\n" +
+ " System.out.println(\"error\");\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ " public X(int a) {\n" +
+ " this(6,16);\n" +
+ " System.out.println(a);\n" +
+ " }\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord004() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test " + getName() + " requires a JRE 15");
+ return;
+ }
+ String contents = "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " record R(int x,int y){}\n" +
+ " R r = new R(100, 200);\n" +
+ " System.out.println(r.x());\n" +
+ " }\n" +
+ "}";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/* resolve */);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(contents, this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0);
+ assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
+ MethodDeclaration methodDeclaration = (MethodDeclaration) node;
+ List<ASTNode> statements = methodDeclaration.getBody().statements();
+ node = statements.get(0);
+ assertEquals("Not a TypDeclaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
+ TypeDeclarationStatement tdStmt = (TypeDeclarationStatement) node;
+ node = tdStmt.getDeclaration();
+ assertEquals("Not a RecordDeclaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord005() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " record R(int x,String y){}\n" +
+ " R r = new R(100, \"Point\");\n" +
+ " System.out.println(r.x());\n" +
+ " }\n" +
+ "}";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0);
+ assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
+ MethodDeclaration methodDeclaration = (MethodDeclaration) node;
+ List<ASTNode> statements = methodDeclaration.getBody().statements();
+ node = statements.get(0);
+ assertEquals("Not a TypDeclaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
+ TypeDeclarationStatement tdStmt = (TypeDeclarationStatement) node;
+ node = tdStmt.getDeclaration();
+ assertEquals("Not a RecordDeclaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ RecordDeclaration record = (RecordDeclaration)node;
+ List<SingleVariableDeclaration> recordComponents = record.recordComponents();
+ assertEquals("There should be 2 record components", 2, recordComponents.size());
+ SingleVariableDeclaration recordComponent = recordComponents.get(0);
+ assertEquals("First record component name should be x","x" , recordComponent.getName().toString());
+ assertEquals("First record component type is int" , "int", recordComponent.getType().toString());
+ IVariableBinding resolveBinding = recordComponent.resolveBinding();
+ assertEquals("First record component binding" , true, resolveBinding.isRecordComponent());
+ recordComponent = recordComponents.get(1);
+ assertEquals("Second record component name should be y","y" , recordComponent.getName().toString());
+ assertEquals("Second record component type is String" , "String", recordComponent.getType().toString());
+ resolveBinding = recordComponent.resolveBinding();
+ assertEquals("Second record component binding" , true, resolveBinding.isRecordComponent());
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord006() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "record X(@MyAnnot int lo) {\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ "@Target({ElementType.FIELD})\n" +
+ "@interface MyAnnot {}";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Record Declaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ RecordDeclaration record = (RecordDeclaration)node;
+ List<SingleVariableDeclaration> recordComponents = record.recordComponents();
+ assertEquals("There should be 1 record component", 1, recordComponents.size());
+ SingleVariableDeclaration recordComponent = recordComponents.get(0);
+ assertEquals("Record component name should be lo","lo" , recordComponent.getName().toString());
+ assertEquals("Record component type is int" , "int", recordComponent.getType().toString());
+ IVariableBinding resolveBinding = recordComponent.resolveBinding();
+ assertEquals("Record component binding" , true, resolveBinding.isRecordComponent());
+ MarkerAnnotation annotation = (MarkerAnnotation)recordComponent.modifiers().get(0);
+ assertEquals("Record component annotation name should be MyAnnot","@MyAnnot" , annotation.toString());
+ assertEquals("Record component binding should not have annotation",0 , resolveBinding.getAnnotations().length);
+
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord007() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "record X(int lo) {\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Record Declaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ RecordDeclaration record = (RecordDeclaration)node;
+ List<SingleVariableDeclaration> recordComponents = record.recordComponents();
+ assertEquals("There should be 1 record component", 1, recordComponents.size());
+ SingleVariableDeclaration recordComponent = recordComponents.get(0);
+ SimpleName recordComponentName = recordComponent.getName();
+ assertEquals("Record component name should be lo","lo" , recordComponentName.toString());
+ ITypeBinding resolveTypeBinding = recordComponentName.resolveTypeBinding();
+ assertEquals("Record component type is int" , "int",resolveTypeBinding.getName() );
+ IVariableBinding resolveBinding = (IVariableBinding)recordComponentName.resolveBinding();
+ assertEquals("Record component binding" , true, resolveBinding.isRecordComponent());
+
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord008() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "import java.lang.annotation.*;\n" +
+ "@Target (ElementType.METHOD)\n" +
+ "@interface MyAnnot {}\n" +
+ "public record X(@MyAnnot int lo) {\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertNotEquals("Not a Record Declaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
+
+
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord009() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String elementType = "package java.lang.annotation;\n" +
+ "public enum ElementType {\n" +
+ " TYPE,\n" +
+ " FIELD,\n" +
+ " METHOD,\n" +
+ " PARAMETER,\n" +
+ " CONSTRUCTOR,\n" +
+ " LOCAL_VARIABLE,\n" +
+ " ANNOTATION_TYPE,\n" +
+ " PACKAGE,\n" +
+ " TYPE_PARAMETER,\n" +
+ " TYPE_USE,\n" +
+ " MODULE,\n" +
+ " RECORD_COMPONENT\n" +
+ "}\n";
+ ICompilationUnit workingCopy2 = getWorkingCopy("/Converter_15/src/java/lang/annotation/ElementType.java", true/*resolve*/);
+ String contents = "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "record X(@MyAnnot int lo) {\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ "@Target({ElementType.RECORD_COMPONENT})\n" +
+ "@interface MyAnnot {}";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ buildAST(
+ elementType,
+ workingCopy2);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Record Declaration", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ RecordDeclaration record = (RecordDeclaration)node;
+ List<SingleVariableDeclaration> recordComponents = record.recordComponents();
+ assertEquals("There should be 1 record component", 1, recordComponents.size());
+ SingleVariableDeclaration recordComponent = recordComponents.get(0);
+ SimpleName recordComponentName = recordComponent.getName();
+ assertEquals("Record component name should be lo","lo" , recordComponentName.toString());
+ ITypeBinding resolveTypeBinding = recordComponentName.resolveTypeBinding();
+ assertEquals("Record component type is int" , "int",resolveTypeBinding.getName() );
+ IVariableBinding resolveBinding = (IVariableBinding)recordComponentName.resolveBinding();
+ assertEquals("Record component binding" , true, resolveBinding.isRecordComponent());
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void _testRecord010() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String elementType = "package java.lang.annotation;\n" +
+ "public enum ElementType {\n" +
+ " TYPE,\n" +
+ " FIELD,\n" +
+ " METHOD,\n" +
+ " PARAMETER,\n" +
+ " CONSTRUCTOR,\n" +
+ " LOCAL_VARIABLE,\n" +
+ " ANNOTATION_TYPE,\n" +
+ " PACKAGE,\n" +
+ " TYPE_PARAMETER,\n" +
+ " TYPE_USE,\n" +
+ " MODULE,\n" +
+ " RECORD_COMPONENT\n" +
+ "}\n";
+ ICompilationUnit workingCopy2 = getWorkingCopy("/Converter_15/src/java/lang/annotation/ElementType.java", true/*resolve*/);
+ String contents = "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "record X(@MyAnnot int lo) {\n" +
+ " public static @MyAnnot int x;\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ "@Target({ElementType.RECORD_COMPONENT})\n" +
+ "@interface MyAnnot {}";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ buildAST(
+ elementType,
+ workingCopy2);
+ try {
+ buildAST(
+ contents,
+ this.workingCopy);
+ } catch (Exception ex) {
+ // This can not be compiled
+ }
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecord011() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public record X() {\n" +
+ " public X {\n" +
+ " System.out.println(\"no error\");\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ List<AbstractTypeDeclaration> types = compilationUnit.types();
+ assertEquals("No. of Types is not 1", types.size(), 1);
+ AbstractTypeDeclaration type = types.get(0);
+ assertTrue("type not a Record", type instanceof RecordDeclaration);
+ RecordDeclaration recDecl = (RecordDeclaration)type;
+ int startPos = recDecl.getRestrictedIdentifierStartPosition();
+ assertEquals("Start position of 'record' keyword is not 7", startPos, 7);
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testClass001() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public class X {\n" +
+ " public X() {\n" +
+ " System.out.println(\"no error\");\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ List<AbstractTypeDeclaration> types = compilationUnit.types();
+ assertEquals("No. of Types is not 1", types.size(), 1);
+ AbstractTypeDeclaration type = types.get(0);
+ assertTrue("type not a type", type instanceof TypeDeclaration);
+ TypeDeclaration typeDecl = (TypeDeclaration)type;
+ assertTrue("type not a class", !typeDecl.isInterface());
+ int startPos = typeDecl.getRestrictedIdentifierStartPosition();
+ assertEquals("Restricter identifier position for class' is not -1", startPos, -1);
+ }
+
+ public void testInterface001() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public interface X {\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ List<AbstractTypeDeclaration> types = compilationUnit.types();
+ assertEquals("No. of Types is not 1", types.size(), 1);
+ AbstractTypeDeclaration type = types.get(0);
+ assertTrue("type not a type", type instanceof TypeDeclaration);
+ TypeDeclaration typeDecl = (TypeDeclaration)type;
+ assertTrue("type not an interface", typeDecl.isInterface());
+ int startPos = typeDecl.getRestrictedIdentifierStartPosition();
+ assertEquals("Restricter identifier position for interface' is not -1", startPos, -1);
+ }
+
+ public void testTextBlock001() throws JavaModelException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public class X {\n" +
+ " public String test001() {\n" +
+ " String s = \"\"\"\n" +
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " \"\"\";\n" +
+ " System.out.println(s);" +
+ " return s;\n" +
+ " }" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Text block statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
+ List fragments = ((VariableDeclarationStatement) node).fragments();
+ assertEquals("Incorrect no of fragments", 1, fragments.size());
+ node = (ASTNode) fragments.get(0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
+ Expression initializer = fragment.getInitializer();
+ assertTrue("Initializer is not a TextBlock", initializer instanceof TextBlock);
+ String escapedValue = ((TextBlock) initializer).getEscapedValue();
+
+ assertTrue("String should not be empty", escapedValue.length() != 0);
+ assertTrue("String should start with \"\"\"", escapedValue.startsWith("\"\"\""));
+
+ String literal = ((TextBlock) initializer).getLiteralValue();
+ assertEquals("literal value not correct",
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " ",
+ literal);
+
+ }
+
+ public void testTextBlock003() throws JavaModelException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public class X {\n" +
+ " public String test001() {\n" +
+ " String s = \"\"\"\n" +
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " \"\"\";\n" +
+ " System.out.println(s);" +
+ " return s;\n" +
+ " }" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Text block statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
+ List fragments = ((VariableDeclarationStatement) node).fragments();
+ assertEquals("Incorrect no of fragments", 1, fragments.size());
+ node = (ASTNode) fragments.get(0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
+ Expression initializer = fragment.getInitializer();
+ assertTrue("Initializer is not a TextBlock", initializer instanceof TextBlock);
+ ITypeBinding binding = initializer.resolveTypeBinding();
+ assertNotNull("No binding", binding);
+ assertEquals("Wrong qualified name", "java.lang.String", binding.getQualifiedName());
+
+ String escapedValue = ((TextBlock) initializer).getEscapedValue();
+
+ assertTrue("String should not be empty", escapedValue.length() != 0);
+ assertTrue("String should start with \"\"\"", escapedValue.startsWith("\"\"\""));
+ assertEquals("escaped value not correct",
+ "\"\"\"\n" +
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " \"\"\"",
+ escapedValue);
+
+ String literal = ((TextBlock) initializer).getLiteralValue();
+ assertEquals("literal value not correct",
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " ",
+ literal);
+ }
+
+ public void testTextBlock004() throws JavaModelException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public class test14 {\n" +
+ " public static void main(String[] args) {\n" +
+ " String s = \"\"\"\n" +
+ " nadknaks vgvh \n" +
+ " \"\"\";\n" +
+ "\n" +
+ " int m = 10;\n" +
+ " m = m* 6;\n" +
+ " System.out.println(s);\n" +
+ " }\n" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter_15/src/test14.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("wrong line number", 3, compilationUnit.getLineNumber(node.getStartPosition()));
+ node = getASTNode(compilationUnit, 0, 0, 1);
+ assertEquals("wrong line number", 7, compilationUnit.getLineNumber(node.getStartPosition()));
+ node = getASTNode(compilationUnit, 0, 0, 2);
+ assertEquals("wrong line number", 8, compilationUnit.getLineNumber(node.getStartPosition()));
+ node = getASTNode(compilationUnit, 0, 0, 3);
+ assertEquals("wrong line number", 9, compilationUnit.getLineNumber(node.getStartPosition()));
+ }
+
+ public void _testPatternInstanceOfExpression001() throws JavaModelException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public class X {\n" +
+ " public String test001(Object o) {\n" +
+ " if (o instanceof String s){\n" +
+ " System.out.println(s);\n" +
+ " return s;\n" +
+ " }\n" +
+ " return null;\n" +
+ " }\n" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
+ IfStatement ifStatement = (IfStatement) node;
+ Expression expression = ifStatement.getExpression();
+ checkSourceRange(expression, "o instanceof String s", contents);
+ assertEquals("Not an instanceof expression", ASTNode.INSTANCEOF_EXPRESSION, expression.getNodeType());
+ InstanceofExpression instanceofExpression = (InstanceofExpression) expression;
+ SingleVariableDeclaration var = instanceofExpression.getPatternVariable();
+ checkSourceRange(var, "String s", contents);
+ }finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void _testPatternInstanceOfExpression002() throws JavaModelException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents =
+ "public class X {\n" +
+ " public String test001(Object o) {\n" +
+ " if (o instanceof String){\n" +
+ " String s = (String)o;\n" +
+ " System.out.println(s);\n" +
+ " return s;\n" +
+ " }\n" +
+ " return null;\n" +
+ " }\n" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
+ IfStatement ifStatement = (IfStatement) node;
+ Expression expression = ifStatement.getExpression();
+ checkSourceRange(expression, "o instanceof String", contents);
+ assertEquals("Not an instanceof expression", ASTNode.INSTANCEOF_EXPRESSION, expression.getNodeType());
+ InstanceofExpression instanceofExpression = (InstanceofExpression) expression;
+ SingleVariableDeclaration var = instanceofExpression.getPatternVariable();
+ assertNull(var);
+ }finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testSealed001() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "public sealed class X permits X1{\n" +
+ "\n" +
+ "}\n" +
+ "non-sealed class X1 extends X {\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ List modifiers = type.modifiers();
+ assertEquals("Incorrect no of modifiers", 2, modifiers.size());
+ Modifier modifier = (Modifier) modifiers.get(1);
+ assertSame("Incorrect modifier keyword", Modifier.ModifierKeyword.SEALED_KEYWORD, modifier.getKeyword());
+ List permittedTypes = type.permittedTypes();
+ assertEquals("Incorrect no of permits", 1, permittedTypes.size());
+ assertEquals("Incorrect type of permit", "org.eclipse.jdt.core.dom.SimpleType", permittedTypes.get(0).getClass().getName());
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(1));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ type = (TypeDeclaration)node;
+ modifiers = type.modifiers();
+ assertEquals("Incorrect no of modfiers", 1, modifiers.size());
+ modifier = (Modifier) modifiers.get(0);
+ assertSame("Incorrect modifier keyword", Modifier.ModifierKeyword.NON_SEALED_KEYWORD, modifier.getKeyword());
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testSealed002() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "public sealed interface X permits X1{\n" +
+ "\n" +
+ "}\n" +
+ "non-sealed interface X1 extends X {\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Record Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ List modifiers = type.modifiers();
+ assertEquals("Incorrect no of modfiers", 2, modifiers.size());
+ Modifier modifier = (Modifier) modifiers.get(1);
+ assertSame("Incorrect modifier keyword", Modifier.ModifierKeyword.SEALED_KEYWORD, modifier.getKeyword());
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testSealed003() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "public sealed interface X permits X1{\n" +
+ "\n" +
+ "}\n" +
+ "non-sealed interface X1 extends X {\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ List<AbstractTypeDeclaration> types = compilationUnit.types();
+ assertEquals("No. of Types is not 2", types.size(), 2);
+ AbstractTypeDeclaration type = types.get(0);
+ if (!type.getName().getIdentifier().equals("X")) {
+ type = types.get(1);
+ }
+ assertTrue("type not a type", type instanceof TypeDeclaration);
+ TypeDeclaration typeDecl = (TypeDeclaration)type;
+ assertTrue("type not an interface", typeDecl.isInterface());
+ List modifiers = type.modifiers();
+ assertEquals("Incorrect no of modifiers", 2, modifiers.size());
+ Modifier modifier = (Modifier) modifiers.get(1);
+ assertSame("Incorrect modifier keyword", Modifier.ModifierKeyword.SEALED_KEYWORD, modifier.getKeyword());
+ int startPos = modifier.getStartPosition();
+ assertEquals("Restricter identifier position for sealed is not 7", startPos, contents.indexOf("sealed"));
+ startPos = typeDecl.getRestrictedIdentifierStartPosition();
+ assertEquals("Restricter identifier position for permits is not 26", startPos, contents.indexOf("permits"));
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testSealed004() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "public sealed class X permits X1{\n" +
+ "\n" +
+ "}\n" +
+ "non-sealed class X1 extends X {\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ List<AbstractTypeDeclaration> types = compilationUnit.types();
+ assertEquals("No. of Types is not 2", types.size(), 2);
+ AbstractTypeDeclaration type = types.get(0);
+ if (!type.getName().getIdentifier().equals("X")) {
+ type = types.get(1);
+ }
+ assertTrue("type not a type", type instanceof TypeDeclaration);
+ TypeDeclaration typeDecl = (TypeDeclaration)type;
+ assertTrue("type not an class", !typeDecl.isInterface());
+ List modifiers = type.modifiers();
+ assertEquals("Incorrect no of modifiers", 2, modifiers.size());
+ Modifier modifier = (Modifier) modifiers.get(1);
+ assertSame("Incorrect modifier keyword", Modifier.ModifierKeyword.SEALED_KEYWORD, modifier.getKeyword());
+ int startPos = modifier.getStartPosition();
+ assertEquals("Restricter identifier position for sealed is not 7", startPos, contents.indexOf("sealed"));
+ startPos = typeDecl.getRestrictedIdentifierStartPosition();
+ assertEquals("Restricter identifier position for permits is not 26", startPos, contents.indexOf("permits"));
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecordConstructor001() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "record X(int lo) {\n" +
+ " public X {\n" +
+ " \n}\n" +
+ " public X(String str) {\n" +
+ " this((str != null) ? str.length() : 0);" +
+ " \n}\n" +
+ " public int abc() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ ASTParser parser= ASTParser.newParser(getAST15());
+ parser.setProject(javaProject);
+ IBinding[] bindings = parser.createBindings(new IJavaElement[] { this.workingCopy.findPrimaryType() }, null);
+ IMethodBinding methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[0];
+ assertEquals("compact constructor name", "X", methodBinding.getName());
+ assertTrue("not a Constructor", methodBinding.isConstructor());
+ assertTrue("not a CompactConstructor", methodBinding.isCompactConstructor());
+ assertTrue("not a CanonicalConstructor", methodBinding.isCanonicalConstructor());
+ methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[1];
+ assertEquals("constructor name", "X", methodBinding.getName());
+ assertTrue("not a Constructor", methodBinding.isConstructor());
+ assertFalse("Is CompactConstructor?", methodBinding.isCompactConstructor());
+ assertFalse("Is CanonicalConstructor?", methodBinding.isCanonicalConstructor());
+ methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[2];
+ assertEquals("method name", "abc", methodBinding.getName());
+ assertFalse("Is a Constructor?", methodBinding.isConstructor());
+ assertFalse("Is a CompactConstructor?", methodBinding.isCompactConstructor());
+ assertFalse("Is CanonicalConstructor?", methodBinding.isCanonicalConstructor());
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testRecordConstructor002() throws CoreException {
+ if (!isJRE15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return;
+ }
+ String contents = "record X(int lo) {\n" +
+ " public X(int lo) {\n" +
+ " this.lo = lo;" +
+ " \n}\n" +
+ " public X(String str) {\n" +
+ " this((str != null) ? str.length() : 0);" +
+ " \n}\n" +
+ " public int abc() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_15/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type", ASTNode.RECORD_DECLARATION, node.getNodeType());
+ ASTParser parser= ASTParser.newParser(getAST15());
+ parser.setProject(javaProject);
+ IBinding[] bindings = parser.createBindings(new IJavaElement[] { this.workingCopy.findPrimaryType() }, null);
+ IMethodBinding methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[0];
+ assertEquals("compact constructor name", "X", methodBinding.getName());
+ assertTrue("not a Constructor", methodBinding.isConstructor());
+ assertTrue("is a CanonicalConstructor", methodBinding.isCanonicalConstructor());
+ assertFalse("is a CompactConstructor", methodBinding.isCompactConstructor());
+ methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[1];
+ assertEquals("constructor name", "X", methodBinding.getName());
+ assertTrue("not a Constructor", methodBinding.isConstructor());
+ assertFalse("Is CanonicalConstructor?", methodBinding.isCanonicalConstructor());
+ assertFalse("Is CompactConstructor?", methodBinding.isCompactConstructor());
+ methodBinding= ((ITypeBinding) bindings[0]).getDeclaredMethods()[2];
+ assertEquals("method name", "abc", methodBinding.getName());
+ assertFalse("Is a Constructor?", methodBinding.isConstructor());
+ assertFalse("Is a CanonicalConstructor?", methodBinding.isCompactConstructor());
+ assertFalse("Is a CompactConstructor?", methodBinding.isCompactConstructor());
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
index bee76a86af..90b70453ca 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1329,6 +1329,7 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
case JavaCore.VERSION_12: return AST.JLS12;
case JavaCore.VERSION_13: return AST.JLS13;
case JavaCore.VERSION_14: return AST.JLS14;
+ case JavaCore.VERSION_15: return AST.JLS15;
default: return AST.JLS2;
}
}
@@ -9175,6 +9176,8 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
assertSame(Modifier.SYNCHRONIZED ,0x0020);
assertSame(Modifier.TRANSIENT ,0x0080);
assertSame(Modifier.VOLATILE ,0x0040);
+ assertSame(Modifier.SEALED ,0x0200);
+ assertSame(Modifier.NON_SEALED ,0x1000);
// check that all
final int[] mods =
@@ -9190,6 +9193,8 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
Modifier.SYNCHRONIZED,
Modifier.TRANSIENT,
Modifier.VOLATILE,
+ Modifier.SEALED,
+ Modifier.NON_SEALED,
};
for (int i=0; i< mods.length; i++) {
@@ -9205,6 +9210,8 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
assertTrue(Modifier.isSynchronized(m) == (m == Modifier.SYNCHRONIZED));
assertTrue(Modifier.isTransient(m) == (m == Modifier.TRANSIENT));
assertTrue(Modifier.isVolatile(m) == (m == Modifier.VOLATILE));
+ assertTrue(Modifier.isSealed(m) == (m == Modifier.SEALED));
+ assertTrue(Modifier.isNonSealed(m) == (m == Modifier.NON_SEALED));
}
if (this.ast.apiLevel() == AST.JLS2) {
@@ -9253,6 +9260,10 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
assertTrue(Modifier.ModifierKeyword.VOLATILE_KEYWORD.toString().equals("volatile")); //$NON-NLS-1$
assertTrue(Modifier.ModifierKeyword.STRICTFP_KEYWORD.toString().equals("strictfp")); //$NON-NLS-1$
assertTrue(Modifier.ModifierKeyword.DEFAULT_KEYWORD.toString().equals("default")); //$NON-NLS-1$
+ if (DOMASTUtil.isFeatureSupportedinAST(this.ast, Modifier.SEALED)) {
+ assertTrue(Modifier.ModifierKeyword.SEALED_KEYWORD.toString().equals("sealed")); //$NON-NLS-1$
+ assertTrue(Modifier.ModifierKeyword.NON_SEALED_KEYWORD.toString().equals("non-sealed")); //$NON-NLS-1$
+ }
final Modifier.ModifierKeyword[] known = {
Modifier.ModifierKeyword.PUBLIC_KEYWORD,
@@ -9266,7 +9277,9 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
Modifier.ModifierKeyword.TRANSIENT_KEYWORD,
Modifier.ModifierKeyword.VOLATILE_KEYWORD,
Modifier.ModifierKeyword.STRICTFP_KEYWORD,
- Modifier.ModifierKeyword.DEFAULT_KEYWORD
+ Modifier.ModifierKeyword.DEFAULT_KEYWORD,
+ Modifier.ModifierKeyword.SEALED_KEYWORD,
+ Modifier.ModifierKeyword.NON_SEALED_KEYWORD
};
// check all modifiers are distinct
@@ -9320,6 +9333,8 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
Modifier.ModifierKeyword.STRICTFP_KEYWORD,
Modifier.ModifierKeyword.TRANSIENT_KEYWORD,
Modifier.ModifierKeyword.VOLATILE_KEYWORD,
+ Modifier.ModifierKeyword.SEALED_KEYWORD,
+ Modifier.ModifierKeyword.NON_SEALED_KEYWORD,
};
int all = 0;
for (int i = 0; i < mods.length; i++) {
@@ -9350,8 +9365,12 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
assertEquals(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD, modifier.getKeyword());
} else if (modifier.isTransient()) {
assertEquals(Modifier.ModifierKeyword.TRANSIENT_KEYWORD, modifier.getKeyword());
- } else {
+ } else if (modifier.isVolatile()) {
assertEquals(Modifier.ModifierKeyword.VOLATILE_KEYWORD, modifier.getKeyword());
+ } else if (modifier.isSealed()) {
+ assertEquals(Modifier.ModifierKeyword.SEALED_KEYWORD, modifier.getKeyword());
+ } else {
+ assertEquals(Modifier.ModifierKeyword.NON_SEALED_KEYWORD, modifier.getKeyword());
}
}
}
@@ -9521,7 +9540,7 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
@SuppressWarnings("deprecation")
public void testASTLevels() throws Exception {
- int[] apilLevels = {AST.JLS2, AST.JLS3, AST.JLS4, AST.JLS8, AST.JLS9, AST.JLS10, AST.JLS11, AST.JLS12, AST.JLS13, AST.JLS14};
+ int[] apilLevels = {AST.JLS2, AST.JLS3, AST.JLS4, AST.JLS8, AST.JLS9, AST.JLS10, AST.JLS11, AST.JLS12, AST.JLS13, AST.JLS14, AST.JLS15};
for (int level : apilLevels) {
try {
DOMASTUtil.checkASTLevel(level);
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
index 9f971ebea2..dc3a5685df 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2019 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -494,7 +494,9 @@ public class AbstractASTTests extends ModifyingResourceTests implements DefaultM
String option = cu.getJavaProject().getOption(JavaCore.COMPILER_COMPLIANCE, true);
long jdkLevel = CompilerOptions.versionToJdkLevel(option);
int JLSLevel = AST_INTERNAL_JLS3;
- if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14)) {
+ if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15)) {
+ JLSLevel = AST_INTERNAL_JLS15;
+ } else if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_14)) {
JLSLevel = AST_INTERNAL_JLS14;
} else if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_13)) {
JLSLevel = AST_INTERNAL_JLS13;
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
index fb8796410a..24f025c36f 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
@@ -235,6 +235,8 @@ public abstract class ConverterTestSetup extends AbstractASTTests {
setUpJavaProject("Converter11", "11"); //$NON-NLS-1$ //$NON-NLS-2$
setUpJavaProject("Converter13", "13"); //$NON-NLS-1$ //$NON-NLS-2$
setUpJavaProject("Converter14", "14"); //$NON-NLS-1$ //$NON-NLS-2$
+ setUpJavaProject("Converter_15", "15"); //$NON-NLS-1$ //$NON-NLS-2$
+ setUpJavaProject("Converter_15_1", "15"); //$NON-NLS-1$ //$NON-NLS-2$
waitUntilIndexesReady(); // needed to find secondary types
PROJECT_SETUP = true;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
index cde2ff5a19..14ff83d06e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,7 +13,8 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.dom;
-import java.lang.reflect.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,6 +35,7 @@ public static Class[] getAllTestClasses() {
ASTConverterBugsTest.class,
ASTConverterBugsTestJLS3.class,
ASTConverterJavadocTest.class,
+ ASTConverterJavadocTest_15.class,
ASTConverter15Test.class,
ASTConverter16Test.class,
ASTConverter17Test.class,
@@ -53,6 +55,7 @@ public static Class[] getAllTestClasses() {
ASTConverter18Test.class,
ASTConverter9Test.class,
ASTConverter14Test.class,
+ ASTConverter_15Test.class,
};
}
public static Test suite() {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
index 73544ea312..404ebb18a9 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15251,7 +15251,7 @@ public void testBug390720b() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436a() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15264,7 +15264,7 @@ public void testBug549436a() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436b() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15277,7 +15277,7 @@ public void testBug549436b() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436c() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15290,7 +15290,7 @@ public void testBug549436c() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436d() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15303,7 +15303,7 @@ public void testBug549436d() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436e() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15316,7 +15316,7 @@ public void testBug549436e() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436f() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15329,7 +15329,7 @@ public void testBug549436f() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436g() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15342,7 +15342,7 @@ public void testBug549436g() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436h() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
this.formatterPrefs.use_tabs_only_for_leading_indentations = true;
@@ -15355,7 +15355,7 @@ public void testBug549436h() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436i() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
this.formatterPrefs.use_tabs_only_for_leading_indentations = true;
@@ -15368,7 +15368,7 @@ public void testBug549436i() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436j() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15381,7 +15381,7 @@ public void testBug549436j() throws JavaModelException {
* https://bugs.eclipse.org/549436 - [13] Formatter support for JEP 355 Text Block
*/
public void testBug549436k() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
setPageWidth80();
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
this.formatterPrefs.use_tabs_only_for_leading_indentations = false;
@@ -15505,14 +15505,14 @@ public void testBug547261() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155a() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
formatSourceInWorkspace("test553155", "in.java", "A_out.java");
}
/**
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155b() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.indent_body_declarations_compare_to_record_header = false;
formatSourceInWorkspace("test553155", "in.java", "B_out.java");
}
@@ -15520,7 +15520,7 @@ public void testBug553155b() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155c() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.brace_position_for_record_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
formatSourceInWorkspace("test553155", "in.java", "C_out.java");
}
@@ -15528,7 +15528,7 @@ public void testBug553155c() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155d() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.brace_position_for_record_constructor = DefaultCodeFormatterConstants.NEXT_LINE;
formatSourceInWorkspace("test553155", "in.java", "D_out.java");
}
@@ -15536,7 +15536,7 @@ public void testBug553155d() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155e() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.parenthesis_positions_in_record_declaration = DefaultCodeFormatterConstants.SEPARATE_LINES;
formatSourceInWorkspace("test553155", "in.java", "E_out.java");
}
@@ -15544,7 +15544,7 @@ public void testBug553155e() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155f() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_after_comma_in_record_components = false;
formatSourceInWorkspace("test553155", "in.java", "F_out.java");
}
@@ -15552,7 +15552,7 @@ public void testBug553155f() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155g() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_after_opening_paren_in_record_declaration = true;
formatSourceInWorkspace("test553155", "in.java", "G_out.java");
}
@@ -15560,7 +15560,7 @@ public void testBug553155g() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155h() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_before_closing_paren_in_record_declaration = true;
formatSourceInWorkspace("test553155", "in.java", "H_out.java");
}
@@ -15568,7 +15568,7 @@ public void testBug553155h() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155i() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_before_comma_in_record_components = true;
formatSourceInWorkspace("test553155", "in.java", "I_out.java");
}
@@ -15576,7 +15576,7 @@ public void testBug553155i() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155j() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_before_opening_brace_in_record_constructor = false;
formatSourceInWorkspace("test553155", "in.java", "J_out.java");
}
@@ -15584,7 +15584,7 @@ public void testBug553155j() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155k() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_before_opening_brace_in_record_declaration = false;
formatSourceInWorkspace("test553155", "in.java", "K_out.java");
}
@@ -15592,7 +15592,7 @@ public void testBug553155k() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155l() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.insert_space_before_opening_paren_in_record_declaration = true;
formatSourceInWorkspace("test553155", "in.java", "L_out.java");
}
@@ -15600,7 +15600,7 @@ public void testBug553155l() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155m() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.alignment_for_record_components = Alignment.M_ONE_PER_LINE_SPLIT + + Alignment.M_FORCE;
formatSourceInWorkspace("test553155", "in.java", "M_out.java");
}
@@ -15608,7 +15608,7 @@ public void testBug553155m() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155n() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.alignment_for_superinterfaces_in_record_declaration = Alignment.M_ONE_PER_LINE_SPLIT + + Alignment.M_FORCE;
formatSourceInWorkspace("test553155", "in.java", "N_out.java");
}
@@ -15616,7 +15616,7 @@ public void testBug553155n() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155o() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.keep_record_constructor_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_ALWAYS;
String source = "record Range(int lo, int hi) {public Range {foo();}}";
formatSource(source,
@@ -15628,7 +15628,7 @@ public void testBug553155o() throws JavaModelException {
* https://bugs.eclipse.org/553155 - [14] Records - Formatter Support
*/
public void testBug553155p() throws JavaModelException {
- setComplianceLevel(CompilerOptions.VERSION_14);
+ setComplianceLevel(CompilerOptions.VERSION_15);
this.formatterPrefs.keep_record_constructor_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_ALWAYS;
this.formatterPrefs.keep_record_declaration_on_one_line = DefaultCodeFormatterConstants.ONE_LINE_ALWAYS;
String source = "record Range(int lo, int hi) {public Range {foo();}}";
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
index 8b0968a2ab..8da0f3690a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
@@ -6,7 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -42,6 +41,7 @@ import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.JavaElementDelta;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.JavaProject;
+import org.eclipse.jdt.internal.core.JrtPackageFragmentRoot;
import org.eclipse.jdt.internal.core.NameLookup;
import org.eclipse.jdt.internal.core.ResolvedSourceMethod;
import org.eclipse.jdt.internal.core.ResolvedSourceType;
@@ -80,7 +80,7 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
protected static boolean isJRE12 = false;
protected static boolean isJRE13 = false;
protected static boolean isJRE14 = false;
- protected static String DEFAULT_MODULES = null;
+ protected static boolean isJRE15 = false;
static {
String javaVersion = System.getProperty("java.version");
String vmName = System.getProperty("java.vm.name");
@@ -93,6 +93,9 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
}
}
long jdkLevel = CompilerOptions.versionToJdkLevel(javaVersion.length() > 3 ? javaVersion.substring(0, 3) : javaVersion);
+ if (jdkLevel >= ClassFileConstants.JDK15) {
+ isJRE15 = true;
+ }
if (jdkLevel >= ClassFileConstants.JDK14) {
isJRE14 = true;
}
@@ -107,28 +110,6 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
}
if (jdkLevel >= ClassFileConstants.JDK9) {
isJRE9 = true;
- if (vmName.contains("HotSpot")) {
- DEFAULT_MODULES = "java.se," +
- "javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web," + // not present in OpenJDK
- "jdk.accessibility,jdk.attach,jdk.compiler,jdk.dynalink,jdk.httpserver," +
- "jdk.incubator.httpclient,jdk.jartool,jdk.javadoc,jdk.jconsole,jdk.jdi," +
- "jdk.jfr," + // not present in OpenJDK
- "jdk.jshell,jdk.jsobject,jdk.management," +
- "jdk.management.cmm,jdk.management.jfr,jdk.management.resource," + // not present in OpenJDK
- "jdk.net," +
- "jdk.packager,jdk.packager.services,jdk.plugin.dom," + // not present in OpenJDK
- "jdk.scripting.nashorn,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.xml.dom," +
- "oracle.desktop,oracle.net"; // not present in OpenJDK
- } else if (vmName.contains("OpenJDK") || vmName.contains("OpenJ9")) {
- DEFAULT_MODULES = "java.se," +
- "jdk.accessibility,jdk.attach,jdk.compiler,jdk.dynalink,jdk.httpserver," +
- "jdk.incubator.httpclient,jdk.jartool,jdk.javadoc,jdk.jconsole,jdk.jdi," +
- "jdk.jshell,jdk.jsobject,jdk.management,jdk.net," +
- "jdk.scripting.nashorn,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.xml.dom";
- } else {
- System.out.println(System.getProperties());
- fail("Unexpected java vm "+javaVersion+" "+vmName);
- }
System.out.println("Recognized Java version '"+javaVersion+"' with vm.name '"+vmName+"'");
}
}
@@ -163,10 +144,17 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
/**
* Internal synonym for constant AST.JSL14
* to alleviate deprecation warnings once AST.JLS14 is deprecated in future.
+ * @deprecated
*/
protected static final int AST_INTERNAL_JLS14 = AST.JLS14;
/**
+ * Internal synonym for constant AST.JSL15
+ * to alleviate deprecation warnings once AST.JLS15 is deprecated in future.
+ */
+ protected static final int AST_INTERNAL_JLS15 = AST.JLS15;
+
+ /**
* Internal synonym for constant AST.JSL11
* to alleviate deprecation warnings once AST.JLS11 is deprecated in future.
* @deprecated
@@ -177,7 +165,7 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
* Internal synonym for the latest AST level.
*
*/
- protected static final int AST_INTERNAL_LATEST = AST.JLS14;
+ protected static final int AST_INTERNAL_LATEST = AST.JLS15;
public static class BasicProblemRequestor implements IProblemRequestor {
public void acceptProblem(IProblem problem) {}
@@ -310,6 +298,22 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
public int compare(Object a, Object b) {
IJavaElementDelta deltaA = (IJavaElementDelta)a;
IJavaElementDelta deltaB = (IJavaElementDelta)b;
+ // Make sure JRT elements and other external JAR elements always
+ // come in the same position with respect to other kind. These two
+ // kinds usually come from two entirely different locations which makes
+ // the sorting by path unpredictable.
+ boolean isAFromJRT = deltaA.getElement() instanceof JrtPackageFragmentRoot;
+ boolean isBFromJRT = deltaB.getElement() instanceof JrtPackageFragmentRoot;
+ int result = 0;
+ if (isAFromJRT) {
+ if (!isBFromJRT) {
+ result = 1;
+ }
+ } else if (isBFromJRT) {
+ result = -1;
+ }
+ if (result != 0)
+ return result;
return toString(deltaA).compareTo(toString(deltaB));
}
private String toString(IJavaElementDelta delta) {
@@ -1532,6 +1536,9 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
protected IJavaProject createJava14Project(String name, String[] srcFolders) throws CoreException {
return createJava9ProjectWithJREAttributes(name, srcFolders, null, "14");
}
+ protected IJavaProject createJava15Project(String name, String[] srcFolders) throws CoreException {
+ return createJava9ProjectWithJREAttributes(name, srcFolders, null, "15");
+ }
protected IJavaProject createJava9ProjectWithJREAttributes(String name, String[] srcFolders, IClasspathAttribute[] attributes) throws CoreException {
return createJava9ProjectWithJREAttributes(name, srcFolders, attributes, "9");
}
@@ -2130,6 +2137,12 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
javaProject.setOptions(options);
+ } else if ("15".equals(compliance)) {
+ Map options = new HashMap();
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_15);
+ javaProject.setOptions(options);
}
result[0] = javaProject;
}
@@ -3228,7 +3241,11 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
newJclSrcString = "JCL18_SRC"; // Use the same source
}
} else {
- if (compliance.equals("14")) {
+ if (compliance.equals("15")) {
+ // Reuse the same 14 stuff as of now. No real need for a new one
+ newJclLibString = "JCL14_LIB";
+ newJclSrcString = "JCL14_SRC";
+ } else if (compliance.equals("14")) {
newJclLibString = "JCL14_LIB";
newJclSrcString = "JCL14_SRC";
} else if (compliance.equals("13")) {
@@ -3388,6 +3405,14 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
new IPath[] {getExternalJCLPath("14"), getExternalJCLSourcePath("14"), getExternalJCLRootSourcePath()},
null);
}
+ } else if ("15".equals(compliance)) {
+ if (JavaCore.getClasspathVariable("JCL14_LIB") == null) {
+ setupExternalJCL("jclMin14");
+ JavaCore.setClasspathVariables(
+ new String[] {"JCL14_LIB", "JCL14_SRC", "JCL_SRCROOT"},
+ new IPath[] {getExternalJCLPath("14"), getExternalJCLSourcePath("14"), getExternalJCLRootSourcePath()},
+ null);
+ }
} else {
if (JavaCore.getClasspathVariable("JCL_LIB") == null) {
setupExternalJCL("jclMin");
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests14.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests14.java
index b7359e5c0d..88bb6495e7 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests14.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests14.java
@@ -31,7 +31,7 @@ public CompilationUnitTests14(String name) {
public void setUpSuite() throws Exception {
super.setUpSuite();
- final String compliance = "14"; //$NON-NLS-1$
+ final String compliance = "15"; //$NON-NLS-1$
this.testProject = createJavaProject("P", new String[] {"src"}, new String[] {getExternalJCLPathString(compliance)}, "bin", compliance); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
createFolder("/P/src/p");
createFile(
@@ -124,7 +124,7 @@ public void tearDownSuite() throws Exception {
* exist in a compilation unit.
*/
public void testGetTypes() throws JavaModelException {
- if (canRunJava14()) {
+ if (canRunJava15()) {
IType[] types = this.cu.getTypes();
String[] typeNames = new String[] {"X", "I", "I2", "I3", "Y", "Colors", "Annot", "Record"};
String[] flags = new String[] {"public", "", "", "", "", "", "", ""};
@@ -165,9 +165,9 @@ public void testGetTypes() throws JavaModelException {
}
}
-public boolean canRunJava14() {
+public boolean canRunJava15() {
try {
- SourceVersion.valueOf("RELEASE_14");
+ SourceVersion.valueOf("RELEASE_15");
} catch(IllegalArgumentException iae) {
return false;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests14.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests14.java
index c251d3ac08..b548e6d491 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests14.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests14.java
@@ -32,9 +32,9 @@ public class CompletionTests14 extends AbstractJavaModelCompletionTests {
public void setUpSuite() throws Exception {
if (COMPLETION_PROJECT == null) {
- COMPLETION_PROJECT = setUpJavaProject("Completion", "14");
+ COMPLETION_PROJECT = setUpJavaProject("Completion", "15");
} else {
- setUpProjectCompliance(COMPLETION_PROJECT, "14");
+ setUpProjectCompliance(COMPLETION_PROJECT, "15");
}
COMPLETION_PROJECT.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
super.setUpSuite();
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests15.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests15.java
new file mode 100644
index 0000000000..08e69b9ae7
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests15.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.model;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+import junit.framework.Test;
+
+public class CompletionTests15 extends AbstractJavaModelCompletionTests {
+
+ static {
+ // TESTS_NAMES = new String[]{"test034"};
+ }
+
+ public CompletionTests15(String name) {
+ super(name);
+ }
+
+ public void setUpSuite() throws Exception {
+ if (COMPLETION_PROJECT == null) {
+ COMPLETION_PROJECT = setUpJavaProject("Completion", "15");
+ } else {
+ setUpProjectCompliance(COMPLETION_PROJECT, "15");
+ }
+ COMPLETION_PROJECT.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ super.setUpSuite();
+ }
+
+ public static Test suite() {
+ return buildModelTestSuite(CompletionTests15.class);
+ }
+
+ // completion for sealed
+ public void test001() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public seal class X permits Y{\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "seal";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("sealed[RESTRICTED_IDENTIFIER]{sealed, null, null, sealed, null, 49}", requestor.getResults());
+
+ }
+
+ // completion for non-sealed
+ public void test002() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public non class X {\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "non";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("non-sealed[RESTRICTED_IDENTIFIER]{non-sealed, null, null, non-sealed, null, 49}",
+ requestor.getResults());
+
+ }
+
+ // completion for sealed if sealed already present
+ public void test003() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public sealed /*here*/seal class X permits Y{\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = " /*here*/seal";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("", requestor.getResults());
+
+ }
+
+ // completion for non-sealed if non-sealed already present
+ public void test004() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public non-sealed /*here*/non class X {\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/non";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("", requestor.getResults());
+
+ }
+
+ // completion for sealed if nonsealed already present
+ public void test005() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public non-sealed /*here*/seal class X permits Y{\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = " /*here*/seal";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("", requestor.getResults());
+
+ }
+
+ // completion for non-sealed if sealed already present
+ public void test006() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public sealed /*here*/non class X {\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/non";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("", requestor.getResults());
+
+ }
+
+ // check if local variable sealed shows up, note that non-sealed is not a valid
+ // variable name
+ public void test007() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/Point.java", "public class Point {\n"
+ + "private void method(){\n" + "int sealed;\n" + "{\n" + " /*here*/sea\n" + "}\n" + "}\n" +
+
+ "}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/sea";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("sealed[LOCAL_VARIABLE_REF]{sealed, null, I, sealed, null, 52}", requestor.getResults());
+
+ }
+
+ // check if permit content assist works
+ public void test008() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/Point.java", "public sealed class Point per{\n" +
+
+ "}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "per";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("permits[RESTRICTED_IDENTIFIER]{permits, null, null, permits, null, 49}", requestor.getResults());
+
+ }
+
+ // check if permit content doesnt work if no sealed
+ public void test009() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/Point.java", "public class Point per{\n" +
+
+ "}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "per";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("", requestor.getResults());
+
+ }
+
+ // check if permit content if the class has extends
+ public void test010() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/Completion/src/X.java",
+ "public sealed class X extends Object per Y{\n" + " public static void main(String[] args){\n"
+ + " System.out.println(100);\n}\n}\n" + " final class Y extends X {}");
+ this.workingCopies[0].getJavaProject(); // assuming single project for all working copies
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "per";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("permits[RESTRICTED_IDENTIFIER]{permits, null, null, permits, null, 49}", requestor.getResults());
+
+ }
+
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java
index cb26327d15..c3876752c8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java
@@ -348,7 +348,7 @@ public class CompletionTestsRequestor2 extends CompletionRequestor {
buffer.append("FIELD_REF_WITH_CASTED_RECEIVER"); //$NON-NLS-1$
break;
case CompletionProposal.KEYWORD :{
- if(CharOperation.equals(proposal.getCompletion(), RestrictedIdentifiers.RECORD))
+ if(isRestrictedIdentifier(proposal.getCompletion()))
buffer.append("RESTRICTED_IDENTIFIER");
else
buffer.append("KEYWORD"); //$NON-NLS-1$
@@ -528,6 +528,18 @@ public class CompletionTestsRequestor2 extends CompletionRequestor {
return buffer;
}
+ private boolean isRestrictedIdentifier(char[] completion) {
+ if(CharOperation.equals(completion, RestrictedIdentifiers.RECORD))
+ return true;
+ if(CharOperation.equals(completion, RestrictedIdentifiers.SEALED))
+ return true;
+ if(CharOperation.equals(completion, RestrictedIdentifiers.NON_SEALED))
+ return true;
+ if(CharOperation.equals(completion, RestrictedIdentifiers.PERMITS))
+ return true;
+
+ return false;
+ }
protected CompletionProposal[] quickSort(CompletionProposal[] collection, int left, int right) {
int original_left = left;
int original_right = right;
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java
index 95b645e750..1a4809673a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMembersTests.java
@@ -45,7 +45,7 @@ public class CreateMembersTests extends AbstractJavaModelTests {
@Override
public void setUpSuite() throws Exception {
super.setUpSuite();
- setUpJavaProject("CreateMembers", "14");
+ setUpJavaProject("CreateMembers", "15");
}
@Override
public void tearDownSuite() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs14Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs14Tests.java
deleted file mode 100644
index 34fe476f66..0000000000
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs14Tests.java
+++ /dev/null
@@ -1,1086 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2019, 2020 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.core.tests.model;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.WorkingCopyOwner;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.ReferenceMatch;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchMatch;
-import org.eclipse.jdt.core.search.TypeReferenceMatch;
-import org.eclipse.jdt.internal.core.LocalVariable;
-import org.eclipse.jdt.internal.core.ResolvedSourceField;
-import org.eclipse.jdt.internal.core.ResolvedSourceType;
-import org.eclipse.jdt.internal.core.SourceField;
-import org.eclipse.jdt.internal.core.SourceMethod;
-import org.eclipse.jdt.internal.core.SourceType;
-
-import junit.framework.Test;
-
-public class JavaSearchBugs14Tests extends AbstractJavaSearchTests {
-
- static {
- // org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
- // TESTS_NUMBERS = new int[] { 19 };
- // TESTS_RANGE = new int[] { 1, -1 };
- // TESTS_NAMES = new String[] {"testBug542559_001"};
- }
-
- public JavaSearchBugs14Tests(String name) {
- super(name);
- this.endChar = "";
- }
-
- public static Test suite() {
- return buildModelTestSuite(JavaSearchBugs14Tests.class, BYTECODE_DECLARATION_ORDER);
- }
-
- class TestCollector extends JavaSearchResultCollector {
- public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException {
- super.acceptSearchMatch(searchMatch);
- }
- }
-
- class ReferenceCollector extends JavaSearchResultCollector {
- protected void writeLine() throws CoreException {
- super.writeLine();
- ReferenceMatch refMatch = (ReferenceMatch) this.match;
- IJavaElement localElement = refMatch.getLocalElement();
- if (localElement != null) {
- this.line.append("+[");
- if (localElement.getElementType() == IJavaElement.ANNOTATION) {
- this.line.append('@');
- this.line.append(localElement.getElementName());
- this.line.append(" on ");
- this.line.append(localElement.getParent().getElementName());
- } else {
- this.line.append(localElement.getElementName());
- }
- this.line.append(']');
- }
- }
- }
-
- class TypeReferenceCollector extends ReferenceCollector {
- protected void writeLine() throws CoreException {
- super.writeLine();
- TypeReferenceMatch typeRefMatch = (TypeReferenceMatch) this.match;
- IJavaElement[] others = typeRefMatch.getOtherElements();
- int length = others==null ? 0 : others.length;
- if (length > 0) {
- this.line.append("+[");
- for (int i=0; i<length; i++) {
- IJavaElement other = others[i];
- if (i>0) this.line.append(',');
- if (other.getElementType() == IJavaElement.ANNOTATION) {
- this.line.append('@');
- this.line.append(other.getElementName());
- this.line.append(" on ");
- this.line.append(other.getParent().getElementName());
- } else {
- this.line.append(other.getElementName());
- }
- }
- this.line.append(']');
- }
- }
- }
-
- protected IJavaProject setUpJavaProject(final String projectName, String compliance, boolean useFullJCL) throws CoreException, IOException {
- // copy files in project from source workspace to target workspace
- IJavaProject setUpJavaProject = super.setUpJavaProject(projectName, compliance, useFullJCL);
- setUpJavaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- return setUpJavaProject;
- }
-
- IJavaSearchScope getJavaSearchScope() {
- return SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("JavaSearchBugs")});
- }
-
- IJavaSearchScope getJavaSearchScopeBugs(String packageName, boolean addSubpackages) throws JavaModelException {
- if (packageName == null) return getJavaSearchScope();
- return getJavaSearchPackageScope("JavaSearchBugs", packageName, addSubpackages);
- }
-
- public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
- if (this.wcOwner == null) {
- this.wcOwner = new WorkingCopyOwner() {};
- }
- return getWorkingCopy(path, source, this.wcOwner);
- }
-
- @Override
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- JAVA_PROJECT = setUpJavaProject("JavaSearchBugs", "14");
- }
-
- public void tearDownSuite() throws Exception {
- deleteProject("JavaSearchBugs");
- super.tearDownSuite();
- }
-
- protected void setUp () throws Exception {
- super.setUp();
- this.resultCollector = new TestCollector();
- this.resultCollector.showAccuracy(true);
- }
-
- // 0 reference of the component in compact constructor
- public void testBug558812_001() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //1 reference of the component in compact constructor
- public void testBug558812_002() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //2 reference of the component in compact constructor
- public void testBug558812_003() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " this.comp_=11;\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //3 reference of the component in compact constructor
- public void testBug558812_004() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " this.comp_=comp_;\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //0 reference of the component in canonical constructor
- public void testBug558812_005() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point (int a) {\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //1 reference of the component in canonical constructor
- public void testBug558812_006() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point (int a) {\n" +
- " comp_=11;\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //1 reference of the component in canonical constructor - part2
- public void testBug558812_007() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point (int a) {\n" +
- " // comp_=11;\n" +
- " this.comp_=a;\n" +
- " }\n" +
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- //1 reference of the component in compact constructor - clashing method parameter
- public void testBug558812_008() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( int comp_) { \n"+
- "} \n"+
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
-
- //1 reference of the component in compact constructor - clashing method's local variable
- public void testBug558812_009() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int comp_=11;\n" +
- "} \n"+
- "}\n"
- );
- IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
- String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
- try {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- search("comp_", FIELD, REFERENCES);
- assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
- } finally {
- javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
- }
- }
-
- // more test case
- // test case of comp_ selection in compact constructor
- // selection - select record type
- public void testBug558812_010() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/Point";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- //TODO: check if record
- }
-
- //selection - select local field in a method in record
- public void testBug558812_011() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int /* here*/compp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/compp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
-
- }
-
- //selection - select local field in a compact constructor in record
- public void testBug558812_012() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " /* here*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
-
- }
-
- //selection - select local field in a compact constructor in record
- public void testBug558812_013() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " /* here*/this.comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/this.comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof ResolvedSourceField);
- }
-
- //selection - select field in a method in record ( using this)
- public void testBug558812_014() throws CoreException {
-
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " /* here*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=/* here*/this.comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/this.comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof ResolvedSourceField);
- }
-
- //selection - select field in a method in record ( without this)
- public void testBug558812_015() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=/* here2*/comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here2*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof ResolvedSourceField);
- ResolvedSourceField sm = (ResolvedSourceField)elements[0];
- IJavaElement parent = sm.getParent();
- SourceType st = (SourceType)parent;
- assertTrue(st.isRecord());
- }
-
- public void testBug558812_016() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " /*here2*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=comp_;\n" +
- " int compp2_=comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here2*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH");
- }
- public void testBug558812_016a() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=comp_;\n" +
- " int compp2_=comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "comp_";
- int start = str.lastIndexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof IField);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH");
- }
-
- public void testBug558812_017() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " /*here2*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=comp_;\n" +
- " int compp2_=comp_;\n" +
- " int compp3_=this.comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here2*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH");
- }
- public void testBug558812_017a() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=comp_;\n" +
- " int compp2_=comp_;\n" +
- " int compp3_=this.comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "comp_";
- int start = str.lastIndexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof IField);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH");
- }
-
- //selection - select CC type
- public void testBug558812_018() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public /* here*/Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- " public Point (int a, int b){\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/Point";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof SourceMethod);
- SourceMethod sm = (SourceMethod)elements[0];
- IJavaElement parent = sm.getParent();
- SourceType st = (SourceType)parent;
- assertTrue(st.isRecord());
- }
-
- //selection - select CC type and search
- public void testBug558812_019() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public /* here*/Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- " public Point (int a, int b){\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- " Point p = new Point(1) ;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/Point";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof SourceMethod);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java void Point.method() [new Point(1)] EXACT_MATCH");
- }
-
- //selection - select non-CC type and search
- public void testBug558812_020() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- " public /* here*/Point (int a, int b){\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- " Point p = new Point(1) ;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/Point";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof SourceMethod);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults("");
- }
-
- //selection - select non-CC type and search- 2
- public void testBug558812_021() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- " public /* here*/Point (int a, int b){\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- " Point p = new Point(1) ;\n" +
- " Point p = new Point(1,2) ;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/Point";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof SourceMethod);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java void Point.method() [new Point(1,2)] EXACT_MATCH");
- }
-
- //selection - select CC type and search- 2
- public void testBug558812_022() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp_) { \n" +
- " public /* here*/Point {\n" +
- " comp_=11;\n" +
- " }\n" +
- " public Point (int a, int b){\n" +
- " comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- " Point p = new Point(1) ;\n" +
- " Point p = new Point(1,2) ;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/Point";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof SourceMethod);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java void Point.method() [new Point(1)] EXACT_MATCH");
- }
-
- //selection - select local field in a compact constructor in record and search1
- public void testBug558812_23() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " /* here*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " int compp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH");
- }
-
- //selection - select local field in a compact constructor in record and search2
- public void testBug558812_24() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " /* here*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " comp_=11;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH");
- }
-
- //selection - select local field in a compact constructor in record and search3
- public void testBug558812_25() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record /* here*/Point(int comp_) { \n" +
- " public Point {\n" +
- " /* here*/comp_=11;\n" +
- " }\n" +
- "public void method ( ) { \n"+
- " comp_=11;\n" +
- " int a=this.comp_;\n" +
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/* here*/comp_";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
- "src/X.java void Point.method() [comp_] EXACT_MATCH\n"+
- "src/X.java void Point.method() [comp_] EXACT_MATCH");
- }
-
- //selection - select record in another file
- public void testBug558812_26() throws CoreException {
- IJavaProject project1 = createJavaProject("JavaSearchBugs14", new String[] {"src"}, new String[] {"JCL14_LIB"}, "bin", "14");
- try {
- Map<String, String> options = project1.getOptions(false);
- options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
- project1.setOptions(options);
- project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- project1.open(null);
- createFolder("/JavaSearchBugs14/src/pack11");
- String fileContent = "package pack11;\n" +
- "public record X11() {\n" +
- "}\n";
- String fileContent2 = "package pack11;\n" +
- "public class X12 {\n" +
- "/*here*/X11 p =null;\n"+
- "}\n";
-
- createFile("/JavaSearchBugs14/src/pack11/X11.java", fileContent);
- createFile("/JavaSearchBugs14/src/pack11/X12.java",fileContent2);
- ICompilationUnit unit = getCompilationUnit("/JavaSearchBugs14/src/pack11/X12.java");
- String x11 = "/*here*/X11";
- int start = fileContent2.indexOf(x11);
- IJavaElement[] elements = unit.codeSelect(start, x11.length());
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof ResolvedSourceType);
- boolean record = ((ResolvedSourceType)elements[0]).isRecord();
- assertTrue(record);
- } finally {
- deleteProject(project1);
- }
- }
-
- //selection - select parameter in normal constructor matching component name
- public void testBug558812_27() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record X(int a) {\n" +
- "public X { \n"+
- " this.a = a; \n"+
- " }\n"+
- "public X(int/*here*/a, int b) { // select the a here\n"+
- "this.a = a;\n"+
- "}\n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/a";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(elements[0] instanceof LocalVariable);
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java X(int, int) [a] EXACT_MATCH");
- }
-
- public void testBug560486_028() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record Point(int comp) { \n" +
- "public void method ( ) { \n"+
- "/*here*/comp(); \n"+
- "} \n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/comp";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue(!(elements[0] instanceof SourceType));
- assertTrue((elements[0] instanceof SourceField));
- }
-
- //Bug 561048 code selection
- public void testBug561048_029() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public class cl {\n"+
- "public cl() {\n"+
- " method1();\n"+
- "}\n"+
- "private void method1() {\n"+
- " String y= this.toString();\n"+
- " if (y instanceof String /*here*/yz) {\n"+
- " System.out.println(yz.toLowerCase());\n"+
- " System.out.println(yz.charAt(0));\n"+
- " }\n"+
- "}\n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/yz";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue((elements[0] instanceof LocalVariable));
- }
-
- public void testBug561048_030() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public class cl {\n"+
- "public cl() {\n"+
- " method1();\n"+
- "}\n"+
- "private void method1() {\n"+
- " String y= this.toString();\n"+
- " if (y instanceof String /*here*/yz) {\n"+
- " System.out.println(yz.toLowerCase());\n"+
- " }\n"+
- "}\n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/yz";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue((elements[0] instanceof LocalVariable));
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java void cl.method1() [yz] EXACT_MATCH");
- }
-
- public void testBug561048_031() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public class cl {\n"+
- "public cl() {\n"+
- " method1();\n"+
- "}\n"+
- "private void method1() {\n"+
- " String y= this.toString();\n"+
- " if (y instanceof String /*here*/yz) {\n"+
- " System.out.println(yz.toLowerCase());\n"+
- " System.out.println(yz.charAt(0));\n"+
- " }\n"+
- "}\n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/yz";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue((elements[0] instanceof LocalVariable));
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java void cl.method1() [yz] EXACT_MATCH\n" +
- "src/X.java void cl.method1() [yz] EXACT_MATCH");
- }
-
- // mix Instance of pattern variable and record
- public void testBug561048_032() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public record cl() {\n"+
- "public cl{\n"+
- " method1();\n"+
- "}\n"+
- "private void method1() {\n"+
- " String y= this.toString();\n"+
- " if (y instanceof String /*here*/yz) {\n"+
- " System.out.println(yz.toLowerCase());\n"+
- " System.out.println(yz.charAt(0));\n"+
- " }\n"+
- "}\n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/yz";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue((elements[0] instanceof LocalVariable));
- search(elements[0], REFERENCES, EXACT_RULE);
- assertSearchResults(
- "src/X.java void cl.method1() [yz] EXACT_MATCH\n" +
- "src/X.java void cl.method1() [yz] EXACT_MATCH");
- }
- public void testBug561132_033() throws CoreException {
- this.workingCopies = new ICompilationUnit[1];
- this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
- "public class cl {\n"+
- "public cl() {\n"+
- " method1();\n"+
- "}\n"+
- "private void method1() {\n"+
- " String y= this.toString();\n"+
- " if (y instanceof String yz) {\n"+
- " System.out.println(/*here*/yz.toLowerCase());\n"+
- " }\n"+
- "}\n"+
- "}\n"
- );
-
- String str = this.workingCopies[0].getSource();
- String selection = "/*here*/yz";
- int start = str.indexOf(selection);
- int length = selection.length();
-
- IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
- assertTrue((elements[0] instanceof LocalVariable));
-
- }
-}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs15Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs15Tests.java
new file mode 100644
index 0000000000..85abef06fc
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs15Tests.java
@@ -0,0 +1,1955 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.model;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.WorkingCopyOwner;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.ReferenceMatch;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.TypeReferenceMatch;
+import org.eclipse.jdt.internal.core.LocalVariable;
+import org.eclipse.jdt.internal.core.ResolvedSourceField;
+import org.eclipse.jdt.internal.core.ResolvedSourceType;
+import org.eclipse.jdt.internal.core.SourceField;
+import org.eclipse.jdt.internal.core.SourceMethod;
+import org.eclipse.jdt.internal.core.SourceType;
+
+import junit.framework.Test;
+// JavaSearchBugs14Tests deleted and all test cases moved to JavaSearchBugs15Tests
+// since both record and instanceof variable are in 2nd preview in Java15
+public class JavaSearchBugs15Tests extends AbstractJavaSearchTests {
+
+ static {
+ // org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
+ // TESTS_NUMBERS = new int[] { 19 };
+ // TESTS_RANGE = new int[] { 1, -1 };
+ // TESTS_NAMES = new String[] {"testBug542559_001"};
+ }
+
+ public JavaSearchBugs15Tests(String name) {
+ super(name);
+ this.endChar = "";
+ }
+
+ public static Test suite() {
+ return buildModelTestSuite(JavaSearchBugs15Tests.class, BYTECODE_DECLARATION_ORDER);
+ }
+
+ class TestCollector extends JavaSearchResultCollector {
+ public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException {
+ super.acceptSearchMatch(searchMatch);
+ }
+ }
+
+ class ReferenceCollector extends JavaSearchResultCollector {
+ protected void writeLine() throws CoreException {
+ super.writeLine();
+ ReferenceMatch refMatch = (ReferenceMatch) this.match;
+ IJavaElement localElement = refMatch.getLocalElement();
+ if (localElement != null) {
+ this.line.append("+[");
+ if (localElement.getElementType() == IJavaElement.ANNOTATION) {
+ this.line.append('@');
+ this.line.append(localElement.getElementName());
+ this.line.append(" on ");
+ this.line.append(localElement.getParent().getElementName());
+ } else {
+ this.line.append(localElement.getElementName());
+ }
+ this.line.append(']');
+ }
+ }
+ }
+
+ class TypeReferenceCollector extends ReferenceCollector {
+ protected void writeLine() throws CoreException {
+ super.writeLine();
+ TypeReferenceMatch typeRefMatch = (TypeReferenceMatch) this.match;
+ IJavaElement[] others = typeRefMatch.getOtherElements();
+ int length = others==null ? 0 : others.length;
+ if (length > 0) {
+ this.line.append("+[");
+ for (int i=0; i<length; i++) {
+ IJavaElement other = others[i];
+ if (i>0) this.line.append(',');
+ if (other.getElementType() == IJavaElement.ANNOTATION) {
+ this.line.append('@');
+ this.line.append(other.getElementName());
+ this.line.append(" on ");
+ this.line.append(other.getParent().getElementName());
+ } else {
+ this.line.append(other.getElementName());
+ }
+ }
+ this.line.append(']');
+ }
+ }
+ }
+
+ protected IJavaProject setUpJavaProject(final String projectName, String compliance, boolean useFullJCL) throws CoreException, IOException {
+ // copy files in project from source workspace to target workspace
+ IJavaProject setUpJavaProject = super.setUpJavaProject(projectName, compliance, useFullJCL);
+ setUpJavaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ return setUpJavaProject;
+ }
+
+ IJavaSearchScope getJavaSearchScope() {
+ return SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject("JavaSearchBugs")});
+ }
+
+ IJavaSearchScope getJavaSearchScopeBugs(String packageName, boolean addSubpackages) throws JavaModelException {
+ if (packageName == null) return getJavaSearchScope();
+ return getJavaSearchPackageScope("JavaSearchBugs", packageName, addSubpackages);
+ }
+
+ public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
+ if (this.wcOwner == null) {
+ this.wcOwner = new WorkingCopyOwner() {};
+ }
+ return getWorkingCopy(path, source, this.wcOwner);
+ }
+
+ @Override
+ public void setUpSuite() throws Exception {
+ super.setUpSuite();
+ JAVA_PROJECT = setUpJavaProject("JavaSearchBugs", "15");
+ }
+
+ public void tearDownSuite() throws Exception {
+ deleteProject("JavaSearchBugs");
+ super.tearDownSuite();
+ }
+
+ protected void setUp () throws Exception {
+ super.setUp();
+ this.resultCollector = new TestCollector();
+ this.resultCollector.showAccuracy(true);
+ }
+
+
+
+
+ // 0 reference of the component in compact constructor
+ public void testBug558812_001() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //1 reference of the component in compact constructor
+ public void testBug558812_002() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //2 reference of the component in compact constructor
+ public void testBug558812_003() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " this.comp_=11;\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //3 reference of the component in compact constructor
+ public void testBug558812_004() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " this.comp_=comp_;\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //0 reference of the component in canonical constructor
+ public void testBug558812_005() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point (int a) {\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //1 reference of the component in canonical constructor
+ public void testBug558812_006() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point (int a) {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //1 reference of the component in canonical constructor - part2
+ public void testBug558812_007() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point (int a) {\n" +
+ " // comp_=11;\n" +
+ " this.comp_=a;\n" +
+ " }\n" +
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //1 reference of the component in compact constructor - clashing method parameter
+ public void testBug558812_008() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( int comp_) { \n"+
+ "} \n"+
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+
+ //1 reference of the component in compact constructor - clashing method's local variable
+ public void testBug558812_009() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int comp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("comp_", FIELD, REFERENCES);
+ assertSearchResults("src/X.java Point(int) [comp_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ // more test case
+ // test case of comp_ selection in compact constructor
+ // selection - select record type
+ public void testBug558812_010() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ //TODO: check if record
+ }
+
+ //selection - select local field in a method in record
+ public void testBug558812_011() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int /* here*/compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/compp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+
+ }
+
+ //selection - select local field in a compact constructor in record
+ public void testBug558812_012() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /* here*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+
+ }
+
+ //selection - select local field in a compact constructor in record
+ public void testBug558812_013() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /* here*/this.comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/this.comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof ResolvedSourceField);
+ }
+
+ //selection - select field in a method in record ( using this)
+ public void testBug558812_014() throws CoreException {
+
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /* here*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=/* here*/this.comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/this.comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof ResolvedSourceField);
+ }
+
+ //selection - select field in a method in record ( without this)
+ public void testBug558812_015() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=/* here2*/comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here2*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof ResolvedSourceField);
+ ResolvedSourceField sm = (ResolvedSourceField)elements[0];
+ IJavaElement parent = sm.getParent();
+ SourceType st = (SourceType)parent;
+ assertTrue(st.isRecord());
+ }
+
+ public void testBug558812_016() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /*here2*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=comp_;\n" +
+ " int compp2_=comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here2*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH");
+ }
+ public void testBug558812_016a() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=comp_;\n" +
+ " int compp2_=comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "comp_";
+ int start = str.lastIndexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof IField);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH");
+ }
+
+ public void testBug558812_017() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /*here2*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=comp_;\n" +
+ " int compp2_=comp_;\n" +
+ " int compp3_=this.comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here2*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH");
+ }
+ public void testBug558812_017a() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=comp_;\n" +
+ " int compp2_=comp_;\n" +
+ " int compp3_=this.comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "comp_";
+ int start = str.lastIndexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof IField);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH");
+ }
+
+ //selection - select CC type
+ public void testBug558812_018() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public /* here*/Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ " public Point (int a, int b){\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceMethod);
+ SourceMethod sm = (SourceMethod)elements[0];
+ IJavaElement parent = sm.getParent();
+ SourceType st = (SourceType)parent;
+ assertTrue(st.isRecord());
+ }
+
+ //selection - select CC type and search
+ public void testBug558812_019() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public /* here*/Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ " public Point (int a, int b){\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " Point p = new Point(1) ;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceMethod);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void Point.method() [new Point(1)] EXACT_MATCH");
+ }
+
+ //selection - select non-CC type and search
+ public void testBug558812_020() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ " public /* here*/Point (int a, int b){\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " Point p = new Point(1) ;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceMethod);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults("");
+ }
+
+ //selection - select non-CC type and search- 2
+ public void testBug558812_021() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ " public /* here*/Point (int a, int b){\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " Point p = new Point(1) ;\n" +
+ " Point p = new Point(1,2) ;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceMethod);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void Point.method() [new Point(1,2)] EXACT_MATCH");
+ }
+
+ //selection - select CC type and search- 2
+ public void testBug558812_022() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp_) { \n" +
+ " public /* here*/Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ " public Point (int a, int b){\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " Point p = new Point(1) ;\n" +
+ " Point p = new Point(1,2) ;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceMethod);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void Point.method() [new Point(1)] EXACT_MATCH");
+ }
+
+ //selection - select local field in a compact constructor in record and search1
+ public void testBug558812_23() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /* here*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH");
+ }
+
+ //selection - select local field in a compact constructor in record and search2
+ public void testBug558812_24() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /* here*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " comp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH");
+ }
+
+ //selection - select local field in a compact constructor in record and search3
+ public void testBug558812_25() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record /* here*/Point(int comp_) { \n" +
+ " public Point {\n" +
+ " /* here*/comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " comp_=11;\n" +
+ " int a=this.comp_;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH\n" +
+ "src/X.java void Point.method() [comp_] EXACT_MATCH\n"+
+ "src/X.java void Point.method() [comp_] EXACT_MATCH");
+ }
+
+ //selection - select record in another file
+ public void testBug558812_26() throws CoreException {
+ IJavaProject project1 = createJavaProject("JavaSearchBugs15", new String[] {"src"}, new String[] {"JCL14_LIB"}, "bin", "14");
+ try {
+ Map<String, String> options = project1.getOptions(false);
+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ project1.setOptions(options);
+ project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ project1.open(null);
+ createFolder("/JavaSearchBugs15/src/pack11");
+ String fileContent = "package pack11;\n" +
+ "public record X11() {\n" +
+ "}\n";
+ String fileContent2 = "package pack11;\n" +
+ "public class X12 {\n" +
+ "/*here*/X11 p =null;\n"+
+ "}\n";
+
+ createFile("/JavaSearchBugs15/src/pack11/X11.java", fileContent);
+ createFile("/JavaSearchBugs15/src/pack11/X12.java",fileContent2);
+ ICompilationUnit unit = getCompilationUnit("/JavaSearchBugs15/src/pack11/X12.java");
+ String x11 = "/*here*/X11";
+ int start = fileContent2.indexOf(x11);
+ IJavaElement[] elements = unit.codeSelect(start, x11.length());
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof ResolvedSourceType);
+ boolean record = ((ResolvedSourceType)elements[0]).isRecord();
+ assertTrue(record);
+ } finally {
+ deleteProject(project1);
+ }
+ }
+
+ //selection - select parameter in normal constructor matching component name
+ public void testBug558812_27() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record X(int a) {\n" +
+ "public X { \n"+
+ " this.a = a; \n"+
+ " }\n"+
+ "public X(int/*here*/a, int b) { // select the a here\n"+
+ "this.a = a;\n"+
+ "}\n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/a";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof LocalVariable);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java X(int, int) [a] EXACT_MATCH");
+ }
+
+ public void testBug560486_028() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int comp) { \n" +
+ "public void method ( ) { \n"+
+ "/*here*/comp(); \n"+
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/comp";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(!(elements[0] instanceof SourceType));
+ assertTrue((elements[0] instanceof SourceField));
+ }
+
+ //Bug 561048 code selection
+ public void testBug561048_029() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class cl {\n"+
+ "public cl() {\n"+
+ " method1();\n"+
+ "}\n"+
+ "private void method1() {\n"+
+ " String y= this.toString();\n"+
+ " if (y instanceof String /*here*/yz) {\n"+
+ " System.out.println(yz.toLowerCase());\n"+
+ " System.out.println(yz.charAt(0));\n"+
+ " }\n"+
+ "}\n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/yz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof LocalVariable));
+ }
+
+ public void testBug561048_030() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class cl {\n"+
+ "public cl() {\n"+
+ " method1();\n"+
+ "}\n"+
+ "private void method1() {\n"+
+ " String y= this.toString();\n"+
+ " if (y instanceof String /*here*/yz) {\n"+
+ " System.out.println(yz.toLowerCase());\n"+
+ " }\n"+
+ "}\n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/yz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof LocalVariable));
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void cl.method1() [yz] EXACT_MATCH");
+ }
+
+ public void testBug561048_031() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class cl {\n"+
+ "public cl() {\n"+
+ " method1();\n"+
+ "}\n"+
+ "private void method1() {\n"+
+ " String y= this.toString();\n"+
+ " if (y instanceof String /*here*/yz) {\n"+
+ " System.out.println(yz.toLowerCase());\n"+
+ " System.out.println(yz.charAt(0));\n"+
+ " }\n"+
+ "}\n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/yz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof LocalVariable));
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void cl.method1() [yz] EXACT_MATCH\n" +
+ "src/X.java void cl.method1() [yz] EXACT_MATCH");
+ }
+
+ public void testBug561132_033() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class cl {\n"+
+ "public cl() {\n"+
+ " method1();\n"+
+ "}\n"+
+ "private void method1() {\n"+
+ " String y= this.toString();\n"+
+ " if (y instanceof String yz) {\n"+
+ " System.out.println(/*here*/yz.toLowerCase());\n"+
+ " }\n"+
+ "}\n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/yz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof LocalVariable));
+
+ }
+
+ // mix Instance of pattern variable and record
+ public void testBug561048_032() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record cl() {\n"+
+ "public cl{\n"+
+ " method1();\n"+
+ "}\n"+
+ "private void method1() {\n"+
+ " String y= this.toString();\n"+
+ " if (y instanceof String /*here*/yz) {\n"+
+ " System.out.println(yz.toLowerCase());\n"+
+ " System.out.println(yz.charAt(0));\n"+
+ " }\n"+
+ "}\n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/yz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof LocalVariable));
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void cl.method1() [yz] EXACT_MATCH\n" +
+ "src/X.java void cl.method1() [yz] EXACT_MATCH");
+ }
+
+
+ //check for permit reference
+ public void test564049_001() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y{ \n" +
+ " }\n" +
+ " final class Y extends X {}\n"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Y", CLASS, REFERENCES);
+ assertSearchResults("src/X.java X [Y] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // select a class and check its permit reference
+ public void test564049_002() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y{ \n" +
+ " }\n" +
+ " final class /*here*/Y extends X {}\n"
+
+ );
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/Y";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof SourceType));
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java X [Y] EXACT_MATCH");
+ }
+
+ // select a class ( at permit location) and check its reference
+ public void test564049_003() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits /*here*/Y{ \n" +
+ " }\n" +
+ " final class Y extends X {}\n"
+
+ );
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/Y";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof SourceType));
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java X [Y] EXACT_MATCH");
+ }
+ //check for permit reference if it is the nth permitted item
+ public void test564049_004() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y,Q{ \n" +
+ " }\n" +
+ " final class Q extends X {}\n" +
+ " final class Y extends X {}\n"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Q", CLASS, REFERENCES);
+ assertSearchResults("src/X.java X [Q] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ // select a class and check its nth permit reference
+ public void test564049_005() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y,Q{ \n" +
+ " }\n" +
+ " final class /*here*/Q extends X {}\n" +
+ " final class Y extends X {}\n"
+
+ );
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/Q";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue((elements[0] instanceof SourceType));
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java X [Q] EXACT_MATCH");
+ }
+
+ //check for permit reference with supertype finegrain
+ public void test564049_006() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y{ \n" +
+ " }\n" +
+ " final class Y extends X {}\n"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Y", CLASS, SUPERTYPE_TYPE_REFERENCE);
+ assertSearchResults("");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //check for permit reference with permittype finegrain
+ public void test564049_007() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y{ \n" +
+ " }\n" +
+ " final class Y extends X {}\n"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Y", CLASS, PERMITTYPE_TYPE_REFERENCE);
+ assertSearchResults("src/X.java X [Y] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ //check for permit reference with permittype or supertype finegrain
+ public void test564049_008() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X permits Y{ \n" +
+ " }\n" +
+ " final class Y extends X {}\n"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Y", CLASS, PERMITTYPE_TYPE_REFERENCE | SUPERTYPE_TYPE_REFERENCE);
+ assertSearchResults("src/X.java X [Y] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ //check for permit reference for qualified type
+ public void test564049_009() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/p1/X.java",
+ "package p1;\n"+
+ "public sealed class X permits A.Y {\n" +
+ " public static void main(String[] args) {}\n" +
+ "}\n" +
+ "class A {\n" +
+ " sealed class Y extends X {\n" +
+ " final class SubInnerY extends Y {}\n" +
+ " } \n" +
+ " final class Z extends Y {}\n" +
+ " final class SubY extends Y {}" +
+ "}"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("A.Y", CLASS, REFERENCES);
+ assertSearchResults(
+ "src/p1/X.java p1.X [A.Y] EXACT_MATCH\n" +
+ "src/p1/X.java p1.A$Y$SubInnerY [Y] EXACT_MATCH\n" +
+ "src/p1/X.java p1.A$Z [Y] EXACT_MATCH\n" +
+ "src/p1/X.java p1.A$SubY [Y] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+
+ //check for permit reference with permittype finegrain - negative test case
+ public void test564049_010() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public sealed class X extends Y{ \n" +
+ " }\n" +
+ " class Y {}\n"
+
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Y", CLASS, PERMITTYPE_TYPE_REFERENCE);
+ assertSearchResults("");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ //permit reference in another file
+ public void test564049_011() throws CoreException {
+ IJavaProject project1 = createJavaProject("JavaSearchBugs15", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin", "15");
+ try {
+ Map<String, String> options = project1.getOptions(false);
+ options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ project1.setOptions(options);
+ project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ project1.open(null);
+ createFolder("/JavaSearchBugs15/src/pack11");
+ String fileContent = "package pack11;\n" +
+ "public sealed class X11_ permits X12_{\n" +
+ "}\n";
+ String fileContent2 = "package pack11;\n" +
+ "final public class /*here*/X12_ extends X11_ {\n" +
+ "}\n";
+
+ createFile("/JavaSearchBugs15/src/pack11/X11_.java", fileContent);
+ createFile("/JavaSearchBugs15/src/pack11/X12_.java",fileContent2);
+ ICompilationUnit unit = getCompilationUnit("/JavaSearchBugs15/src/pack11/X12_.java");
+ String x11 = "/*here*/X12_";
+ int start = fileContent2.indexOf(x11);
+ IJavaElement[] elements = unit.codeSelect(start, x11.length());
+ assertTrue(elements.length ==1);
+ IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
+ search(elements[0].getElementName(), TYPE, PERMITTYPE_TYPE_REFERENCE, EXACT_RULE, scope);
+ assertSearchResults("src/pack11/X11_.java pack11.X11_ [X12_] EXACT_MATCH");
+ } finally {
+ deleteProject(project1);
+ }
+ }
+ public void testRecordReferenceInNonSourceJar() throws CoreException {
+
+ IType typeRecord = getClassFile("JavaSearchBugs", "lib/record_reference_in_nonsource_jar.jar", "pack", "rr.class").getType();//record
+ search(
+ typeRecord,
+ ALL_OCCURRENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/record_reference_in_nonsource_jar.jar pack.rr [No source] EXACT_MATCH",
+ this.resultCollector);
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=565180 ( reason for 1 result instead of 3)
+ }
+
+ public void testRecordReferenceInSourceJar() throws CoreException {
+
+ IType typeRecord = getClassFile("JavaSearchBugs", "lib/record_reference_in_source_jar.jar", "pack", "rr2.class").getType();//record
+ search(
+ typeRecord,
+ ALL_OCCURRENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/record_reference_in_source_jar.jar pack.c1.ob EXACT_MATCH\n" +
+ "lib/record_reference_in_source_jar.jar pack.c1.ob EXACT_MATCH\n" +
+ "lib/record_reference_in_source_jar.jar pack.rr2 EXACT_MATCH",
+ this.resultCollector);
+ }
+
+ public void testPermitReferenceInNonSourceJar() throws CoreException {
+
+ IType myClass = getClassFile("JavaSearchBugs", "lib/permit_reference_in_nonsource_jar.jar", "pack", "PermitClass.class").getType();
+ search(
+ myClass,
+ ALL_OCCURRENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/permit_reference_in_nonsource_jar.jar pack.PermitClass [No source] EXACT_MATCH",
+ this.resultCollector);
+
+ }
+
+ public void testPermitReferenceInSourceJar() throws CoreException {
+
+ IType myClass = getClassFile("JavaSearchBugs", "lib/permit_reference_in_source_jar.jar", "pack", "PermitClass2.class").getType();
+ search(
+ myClass,
+ ALL_OCCURRENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/permit_reference_in_source_jar.jar pack.MyClass2 EXACT_MATCH\n" +
+ "lib/permit_reference_in_source_jar.jar pack.PermitClass2 EXACT_MATCH",
+ this.resultCollector);
+
+ }
+
+ public void testAnnotationsInRecords1() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "record X(@MyAnnot int lo) {\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ "@Target({ElementType.FIELD})\n" +
+ "@interface MyAnnot {}";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("MyAnnot", ANNOTATION_TYPE, ALL_OCCURRENCES);
+ assertSearchResults(
+ "src/X.java X.lo [MyAnnot] EXACT_MATCH\n" +
+ "src/X.java MyAnnot [MyAnnot] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testAnnotationsInRecords2() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "record X(@MyAnnot int lo) {\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ "@Target({ElementType.FIELD})\n" +
+ "@interface MyAnnot {}";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("MyAnnot", ANNOTATION_TYPE, REFERENCES);
+ assertSearchResults("src/X.java X.lo [MyAnnot] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+ public void testAnnotationsInRecords3() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "record X(@MyAnnot int lo) {\n" +
+ " public static @MyAnnot int x;\n" +
+ " public int lo() {\n" +
+ " return this.lo;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ "@Target({ElementType.RECORD_COMPONENT})\n" +
+ "@interface MyAnnot {}";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("MyAnnot", ANNOTATION_TYPE, REFERENCES);
+ assertSearchResults(
+ "src/X.java X.lo [MyAnnot] EXACT_MATCH\n" +
+ "src/X.java X.x [MyAnnot] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+ public void testAnnotationsInRecords4() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "package test1;\n" +
+ "import java.lang.annotation.ElementType;\n" +
+ "public record X() {\n" +
+ " static String myObject = \"Foo\";\n" +
+ " public void foo() {\n" +
+ " String myString = (@Annot String) myObject;\n" +
+ " String myString1 = (@Annot1 @Annot String) myObject;\n" +
+ " }\n" +
+ "}\n" +
+ "@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n" +
+ "@interface Annot {}\n" +
+ "@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n" +
+ "@interface Annot1 {}\n" +
+ "";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Annot", ANNOTATION_TYPE, REFERENCES);
+
+ assertSearchResults(
+ "src/X.java void X.foo() [Annot] EXACT_MATCH\n" +
+ "src/X.java void X.foo() [Annot] EXACT_MATCH");
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+ public void testAnnotationsInRecords5() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "package test1;\n" +
+ "import java.lang.annotation.ElementType;\n" +
+ "public record X() {\n" +
+ " static String myObject = \"Foo\";\n" +
+ " public void foo() {\n" +
+ " String myString = (@Annot String) myObject;\n" +
+ " String myString1 = (@Annot1 @Annot String) myObject;\n" +
+ " }\n" +
+ "}\n" +
+ "@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n" +
+ "@interface Annot {}\n" +
+ "@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n" +
+ "@interface Annot1 {}";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Annot", ANNOTATION_TYPE, REFERENCES);
+ assertSearchResults(
+ "src/X.java void X.foo() [Annot] EXACT_MATCH\n" +
+ "src/X.java void X.foo() [Annot] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+ public void testAnnotationsInRecords6() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "package test1;\n" +
+ "\n" +
+ "import java.lang.annotation.ElementType;\n" +
+ "\n" +
+ "public record X2() {\n" +
+ " public interface Helper<T> {\n" +
+ " }\n" +
+ " public class Foo1<T> implements @Annot_ Helper<T> {\n" +
+ " }\n" +
+ " public class Foo2<T> implements @Annot_ @Annot1_ Helper<T> {\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "@java.lang.annotation.Target (ElementType.TYPE_USE)\n" +
+ "@interface Annot_ {}\n" +
+ "\n" +
+ "@java.lang.annotation.Target (ElementType.TYPE_USE)\n" +
+ "@interface Annot1_ {}";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Annot_", ANNOTATION_TYPE, REFERENCES);
+ assertSearchResults(
+ "src/X.java X2$Foo1 [Annot_] EXACT_MATCH\n" +
+ "src/X.java X2$Foo2 [Annot_] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+ public void testAnnotationsInRecords7() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "package test1;\n" +
+ "import java.lang.annotation.ElementType;\n" +
+ "public record X3() {\n" +
+ " public record Helper<T>() {\n" +
+ " }\n" +
+ " public record Base() {\n" +
+ " }\n" +
+ " public static void UnboundedWildcard1 (Helper<@Annot__ ?> x) {\n" +
+ " }\n" +
+ " public static void UnboundedWildcard2 (Helper<@Annot1__ @Annot__ ?> x) {\n" +
+ " }\n" +
+ " public static void BoundedWildcard1 (Helper<@Annot__ ? extends Base> x) {\n" +
+ " }\n" +
+ " public static void BoundedWildcard2 (Helper<@Annot1__ @Annot__ ? extends Base> x) {\n" +
+ " }\n" +
+ "}\n" +
+ "@java.lang.annotation.Target (ElementType.TYPE_USE)\n" +
+ "@interface Annot__ {}\n" +
+ "@java.lang.annotation.Target (ElementType.TYPE_USE)\n" +
+ "@interface Annot1__ {}\n" +
+ "";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Annot__", ANNOTATION_TYPE, REFERENCES);
+ assertSearchResults(
+ "src/X.java void X3.UnboundedWildcard1(Helper<?>) [Annot__] EXACT_MATCH\n" +
+ "src/X.java void X3.UnboundedWildcard2(Helper<?>) [Annot__] EXACT_MATCH\n" +
+ "src/X.java void X3.BoundedWildcard1(Helper<? extends Base>) [Annot__] EXACT_MATCH\n" +
+ "src/X.java void X3.BoundedWildcard2(Helper<? extends Base>) [Annot__] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testAnnotationsInRecords8() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+
+ String contents = "package test1;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "public record X() {\n" +
+ " public static void main(String[] args) {\n" +
+ " Outer outer = new Outer();\n" +
+ " Outer.@Marker1 Inner first = outer.new Inner();\n" +
+ " Outer.@Marker2 Inner second = outer.new Inner() ;\n" +
+ " Outer.Inner.@Marker1 Deeper deeper = second.new Deeper();\n" +
+ " Outer.Inner.Deeper deeper2 = second.new Deeper();\n" +
+ " }\n" + "}\n" + "class Outer {\n" +
+ " public class Inner {\n" +
+ " public class Deeper {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker {}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker1 {}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker2 {}\n";
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",contents);
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); //assuming single project for all working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ search("Marker1", ANNOTATION_TYPE, REFERENCES);
+ assertSearchResults(
+ "src/X.java void X.main(String[]) [Marker1] EXACT_MATCH\n" +
+ "src/X.java void X.main(String[]) [Marker1] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+ // test all occurrences of annotation of non-source jar with record
+ public void testAnnnotationInRecordJar() throws CoreException {
+
+ IType typeRecord = getClassFile("JavaSearchBugs", "lib/annotation_in_record_jar.jar", "pack", "X99.class").getType();
+ search(
+ typeRecord,
+ ALL_OCCURRENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/annotation_in_record_jar.jar pack.MyRecord.lo [No source] EXACT_MATCH\n" +
+ "lib/annotation_in_record_jar.jar pack.X99 [No source] EXACT_MATCH",
+ this.resultCollector);
+ }
+
+ // test all occurrences of annotation of source jar with record
+ public void testAnnnotationInRecordSourceJar() throws CoreException {
+
+ IType typeRecord = getClassFile("JavaSearchBugs", "lib/annotation_in_record_source_jar.jar", "pack", "X100.class").getType();
+ search(
+ typeRecord,
+ ALL_OCCURRENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/annotation_in_record_source_jar.jar pack.MyRecord.lo EXACT_MATCH\n" +
+ "lib/annotation_in_record_source_jar.jar pack.X100 EXACT_MATCH",
+ this.resultCollector);
+ }
+ // test all reference of annotation of non-source jar with record
+ public void testAnnnotationJustReferenceInRecordJar() throws CoreException {
+
+ IType typeRecord = getClassFile("JavaSearchBugs", "lib/annotation_in_record_jar.jar", "pack", "X99.class").getType();
+ search(
+ typeRecord,
+ REFERENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/annotation_in_record_jar.jar pack.MyRecord.lo [No source] EXACT_MATCH",
+ this.resultCollector);
+ }
+ // test all reference of annotation of source jar with record
+ public void testAnnnotationJustReferenceInRecordSourceJar() throws CoreException {
+
+ IType typeRecord = getClassFile("JavaSearchBugs", "lib/annotation_in_record_source_jar.jar", "pack", "X100.class").getType();
+ search(
+ typeRecord,
+ REFERENCES,
+ getJavaSearchScope(),
+ this.resultCollector);
+ assertSearchResults(
+ "lib/annotation_in_record_source_jar.jar pack.MyRecord.lo EXACT_MATCH",
+ this.resultCollector);
+ }
+
+ public void test566507_componentSelectAndSearch() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int /* here*/comp_) { \n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "/* here*/comp_";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceField);
+ search(elements[0], REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point(int) [comp_] EXACT_MATCH");
+
+ }
+ public void test566507_fieldSelectAndSearch() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public record Point(int /* here*/comp_) { \n" +
+ " public static int staticF =0;\n" +
+ " public Point {\n" +
+ " comp_=11;\n" +
+ " staticF=11;\n" +
+ " }\n" +
+ "public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ "} \n"+
+ "}\n"
+ );
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "staticF";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+ assertTrue(elements[0] instanceof SourceField);
+ search(elements[0], ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java Point.staticF [staticF] EXACT_MATCH\n" +
+ "src/X.java Point(int) [staticF] EXACT_MATCH");
+
+ }
+
+ public void test566062_001() throws CoreException {
+ this.workingCopies = new ICompilationUnit[2];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/pack/test.java",
+ "public class /* here*/test { \n" +
+ " /**\n" +
+ " * @see mod.one/pack.test\n" +
+ " */\n" +
+ " public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@link mod.one/pack.test abc}\n" +
+ " */\n" +
+ " public void apply ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@linkplain mod.one/pack.test abc}\n" +
+ " */\n" +
+ " public void evaluate ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ "}\n"
+ );
+
+ this.workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/module-info.java",
+ "import pack.*;\n" +
+ "module mod.one {}");
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "test";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+
+ search(elements[0], ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/pack/test.java pack.test [test] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.method() [pack.test] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.apply() [pack.test] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.evaluate() [pack.test] EXACT_MATCH");
+ }
+
+ public void test566062_002() throws CoreException {
+ this.workingCopies = new ICompilationUnit[2];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/pack/test.java",
+ "public class test { \n" +
+ " public int /* here*/val;" +
+ " /**\n" +
+ " * @see mod.one/pack.test#val\n" +
+ " */\n" +
+ " public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@link mod.one/pack.test#val abc}\n" +
+ " */\n" +
+ " public void apply ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@linkplain mod.one/pack.test#val abc}\n" +
+ " */\n" +
+ " public void evaluate ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ "}\n"
+ );
+
+ this.workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/module-info.java",
+ "import pack.*;\n" +
+ "module mod.one {}");
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "val";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+
+ search(elements[0], ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/pack/test.java pack.test.val [val] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.method() [val] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.apply() [val] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.evaluate() [val] EXACT_MATCH");
+ }
+
+ public void test566062_003() throws CoreException {
+ this.workingCopies = new ICompilationUnit[2];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/pack/test.java",
+ "public class test { \n" +
+ " public void /* here*/setComp ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * @see mod.one/pack.test#setComp()\n" +
+ " */\n" +
+ " public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@link mod.one/pack.test#setComp() setComp}\n" +
+ " */\n" +
+ " public void apply ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@linkplain mod.one/pack.test#setComp() setComp}\n" +
+ " */\n" +
+ " public void evaluate ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ "}\n"
+ );
+
+ this.workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/module-info.java",
+ "import pack.*;\n" +
+ "module mod.one {}");
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "setComp";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+
+ search(elements[0], ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/pack/test.java void pack.test.setComp() [setComp] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.method() [setComp()] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.apply() [setComp()] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.evaluate() [setComp()] EXACT_MATCH");
+ }
+
+ public void test566062_004() throws CoreException {
+ this.workingCopies = new ICompilationUnit[2];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/pack/test.java",
+ "public class /* here*/test { \n" +
+ " public int /* here*/val;" +
+ " /**\n" +
+ " * @see mod.one/pack.test#apply()\n" +
+ " */\n" +
+ " public void method ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@link mod.one/pack.test abc}\n" +
+ " */\n" +
+ " public void apply ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ " /**\n" +
+ " * {@linkplain mod.one/pack.test#val abc}\n" +
+ " */\n" +
+ " public void evaluate ( ) { \n"+
+ " int compp_=11;\n" +
+ " } \n"+
+ "}\n"
+ );
+
+ this.workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/module-info.java",
+ "import pack.*;\n" +
+ "module mod.one {}");
+
+ String str = this.workingCopies[0].getSource();
+ String selection = "test";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertTrue(elements.length ==1);
+
+ search(elements[0], ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/pack/test.java pack.test [test] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.method() [pack.test] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.apply() [pack.test] EXACT_MATCH\n"+
+ "src/pack/test.java void pack.test.evaluate() [pack.test] EXACT_MATCH");
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
index 75b489cded..53740a9e94 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
@@ -202,6 +202,13 @@ public void setUpSuite() throws Exception {
addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b140156.jar", false);
addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b164791.jar", false);
addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib/b166348.jar", false);
+
+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/record_reference_in_nonsource_jar.jar"));
+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/record_reference_in_source_jar.jar"));
+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/permit_reference_in_nonsource_jar.jar"));
+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/permit_reference_in_source_jar.jar"));
+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/annotation_in_record_jar.jar"));
+ removeClasspathEntry(JAVA_PROJECT, new Path("/JavaSearchBugs/lib/annotation_in_record_source_jar.jar"));
}
@Override
public void tearDownSuite() throws Exception {
@@ -8886,6 +8893,8 @@ public void testBug185452() throws CoreException {
packageCollector);
}
+
+
/**
* @bug 194185 [search] for package declarations finds also sub-packages
* @test Ensure that exact package is found when no
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
index 5f31b7e927..9ac615394d 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2019 IBM Corporation and others.
+ * Copyright (c) 2016, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -6295,7 +6295,9 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
}
public void testBug526054() throws Exception {
- if (!isJRE9) return;
+ // JDK 15 has removed the only module that was not part of module default root module jdk.rmic.
+ // Hence, we no longer need this test for JDK 15 and above.
+ if (!isJRE9 || isJRE15) return;
ClasspathJrt.resetCaches();
try {
// jdk.rmic is not be visible to code in an unnamed module, but using requires we can see the module.
@@ -6345,6 +6347,9 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
}
public void testBug526054b() throws Exception {
+ // JDK 15 has removed the only module that was not part of module default root module jdk.rmic.
+ // Hence, we no longer need this test for JDK 15 and above.
+ if (!isJRE9 || isJRE15) return;
ClasspathJrt.resetCaches();
try {
// one project can see jdk.rmic/sun.rmi.rmic
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
index fe63821c1e..07c8560800 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
@@ -80,7 +80,7 @@ public class ReconcilerTests extends ModifyingResourceTests {
}
}
- /*package*/ static final int JLS_LATEST = AST.JLS14;
+ /*package*/ static final int JLS_LATEST = AST.JLS15;
static class ReconcileParticipant extends CompilationParticipant {
IJavaElementDelta delta;
@@ -5972,24 +5972,24 @@ public void testBug534865() throws CoreException, IOException {
}
}
public void testBug562637() throws CoreException, IOException, InterruptedException {
- if (!isJRE14) return;
- IJavaProject project14 = null;
+ if (!isJRE15) return;
+ IJavaProject project15 = null;
try {
- project14 = createJava14Project("Reconciler14", new String[] {"src"});
- project14.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
- project14.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
- project14.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
- project14.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
- project14.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ project15 = createJava14Project("Reconciler_15", new String[] {"src"});
+ project15.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ project15.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ project15.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ project15.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ project15.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
String[] sources = new String[2];
char[][] sourceAsArray = new char[2][];
- createFolder("/Reconciler14/src/p");
- createFolder("/Reconciler14/src/q");
+ createFolder("/Reconciler_15/src/p");
+ createFolder("/Reconciler_15/src/q");
sources[0] = "package p;\n" +
"public record X(int a, int b) {\n" +
" public X {\n" +
- " this.a = a * 2;\n" +
+ " a = a * 2;\n" +
" }\n" +
" public void foo() {}\n" +
"}\n" +
@@ -6001,7 +6001,7 @@ public void testBug562637() throws CoreException, IOException, InterruptedExcept
" }\n" +
"}";
createFile(
- "/Reconciler14/src/p/X.java",
+ "/Reconciler_15/src/p/X.java",
sources[0]
);
sourceAsArray[0] = sources[0].toCharArray();
@@ -6018,7 +6018,7 @@ public void testBug562637() throws CoreException, IOException, InterruptedExcept
"} ";
createFile(
- "/Reconciler14/src/q/Y.java",
+ "/Reconciler_15/src/q/Y.java",
sources[1]
);
sourceAsArray[1] = sources[1].toCharArray();
@@ -6026,17 +6026,63 @@ public void testBug562637() throws CoreException, IOException, InterruptedExcept
this.workingCopies = new ICompilationUnit[2];
// Get first working copy and verify that there's no error
this.problemRequestor.initialize(sourceAsArray[0]);
- this.workingCopies[0] = getCompilationUnit("/Reconciler14/src/p/X.java").getWorkingCopy(this.wcOwner, null);
+ this.workingCopies[0] = getCompilationUnit("/Reconciler_15/src/p/X.java").getWorkingCopy(this.wcOwner, null);
assertNoProblem(sourceAsArray[0], this.workingCopies[0]);
// Get second working copy and verify that there's no error
this.problemRequestor.initialize(sourceAsArray[1]);
- this.workingCopies[1] = getCompilationUnit("/Reconciler14/src/q/Y.java").getWorkingCopy(this.wcOwner, null);
+ this.workingCopies[1] = getCompilationUnit("/Reconciler_15/src/q/Y.java").getWorkingCopy(this.wcOwner, null);
assertNoProblem(sourceAsArray[1], this.workingCopies[1]);
} finally {
- if (project14 != null)
- deleteProject(project14);
+ if (project15 != null)
+ deleteProject(project15);
+ }
+}
+public void testBug564613_001() throws CoreException, IOException, InterruptedException {
+ if (!isJRE15) return;
+ IJavaProject project15 = null;
+ try {
+ project15 = createJava15Project("Reconciler_15", new String[] {"src"});
+ project15.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ project15.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ project15.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ project15.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ project15.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+
+ String[] sources = new String[2];
+ char[][] sourceAsArray = new char[2][];
+ createFolder("/Reconciler_15/src/X");
+ sources[0] =
+ "public sealed class X permits Y Z {} \n" +
+ "final class Y extends X{} \n" +
+ "final class Z extends X{}";
+ createFile(
+ "/Reconciler_15/src/X.java",
+ sources[0]
+ );
+ sourceAsArray[0] = sources[0].toCharArray();
+ waitUntilIndexesReady();
+ // Get first working copy and verify that there's no error
+ this.problemRequestor.initialize(sourceAsArray[0]);
+ this.workingCopy = getCompilationUnit("/Reconciler_15/src/X.java").getWorkingCopy(this.wcOwner, null);
+ try {
+ this.workingCopy.makeConsistent(null);
+ assertProblemsInclude("Unexpected Errors",
+ "----------\n" +
+ "1. ERROR in /Reconciler_15/src/X.java (at line 1)\n" +
+ " public sealed class X permits Y Z {} \n" +
+ " ^^^^^^^\n" +
+ "Syntax error on token \"permits\", { expected\n" +
+ "----------\n");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ assertFalse("Failure: AIOOBE thrown", true);
+ }
+
+
+ } finally {
+ if (project15 != null)
+ deleteProject(project15);
}
}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java
index 355c4427ed..d92f13fd2e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java
@@ -43,7 +43,7 @@ public class ReconcilerTests9 extends ModifyingResourceTests {
protected ICompilationUnit workingCopy;
protected ProblemRequestor problemRequestor;
- /*package*/ static final int JLS_LATEST = AST.JLS14;
+ /*package*/ static final int JLS_LATEST = AST.JLS15;
/**
*/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RecordsElementTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RecordsElementTests.java
index 99ae94eff9..893e309b52 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RecordsElementTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RecordsElementTests.java
@@ -13,15 +13,23 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.model;
+import java.io.File;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
+import org.eclipse.jdt.core.tests.util.Util;
import junit.framework.Test;
@@ -35,10 +43,10 @@ public class RecordsElementTests extends AbstractJavaModelTests {
super(name);
}
public static Test suite() {
- return buildModelTestSuite(AbstractCompilerTest.F_14, RecordsElementTests.class);
+ return buildModelTestSuite(AbstractCompilerTest.F_15, RecordsElementTests.class);
}
protected IJavaProject createJavaProject(String projectName) throws CoreException {
- IJavaProject createJavaProject = super.createJavaProject(projectName, new String[] {"src"}, new String[] {"JCL14_LIB"}, "bin", "14");
+ IJavaProject createJavaProject = super.createJavaProject(projectName, new String[] {"src"}, new String[] {"JCL14_LIB"}, "bin", "15");
createJavaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
return createJavaProject;
}
@@ -108,6 +116,8 @@ public class RecordsElementTests extends AbstractJavaModelTests {
assertEquals("Incorret no of types", 1, types.length);
assertTrue("type should be a record", types[0].isRecord());
assertEquals("type should be a record", IJavaElement.TYPE, types[0].getElementType());
+ IField[] fields = types[0].getFields();
+ assertEquals("Incorret no of fields", 0, fields.length);
IField[] recordComponents = types[0].getRecordComponents();
assertNotNull("should be null", recordComponents);
assertEquals("Incorret no of components", 2, recordComponents.length);
@@ -145,7 +155,235 @@ public class RecordsElementTests extends AbstractJavaModelTests {
assertEquals("type should be a record", IJavaElement.TYPE, types[0].getElementType());
IMethod[] methods = types[0].getMethods();
assertNotNull("should not be null", methods);
- assertEquals("Incorret no of methods", 0, methods.length);
+ assertEquals("Incorret no of elements", 0, methods.length);
+ }
+ finally {
+ deleteProject("RecordsElement");
+ }
+ }
+ // Test record with compact canonical constructor
+ public void test005() throws Exception {
+ try {
+ this.workingCopies = new ICompilationUnit[1];
+ IJavaProject project = createJavaProject("RecordsElement");
+ project.open(null);
+ String fileContent = "public record Point(int x1, int x2) {\n" +
+ " public Point {\n" +
+ " x1 = 1;\n" +
+ " }\n" +
+ "}\n";
+ createFile( "/RecordsElement/src/X.java", fileContent);
+ ICompilationUnit unit = getCompilationUnit("/RecordsElement/src/X.java");
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 1, types.length);
+ assertTrue("type should be a record", types[0].isRecord());
+ assertEquals("type should be a record", IJavaElement.TYPE, types[0].getElementType());
+ IMethod[] methods = types[0].getMethods();
+ assertNotNull("should not be null", methods);
+ assertEquals("Incorret no of elements", 1, methods.length);
+ IMethod constructor = methods[0];
+ assertTrue("should be a constructor", constructor.isConstructor());
+ //assertTrue("should be a canonical constructor", constructor.isCanonicalConstructor());
+ assertEquals("incorrect number of parameters", 2, constructor.getNumberOfParameters());
+ String[] parameterNames = constructor.getParameterNames();
+ assertEquals("incorrect numer of names", 2, parameterNames.length);
+ assertEquals("incorrect parameter names", "x1", parameterNames[0]);
+ assertEquals("incorrect parameter names", "x2", parameterNames[1]);
+
+ this.workingCopies[0] = getWorkingCopy("/RecordsElement/src/X.java", fileContent);
+ // Test code select
+ String str = this.workingCopies[0].getSource();
+ String selection = "x1";
+ int start = str.lastIndexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertEquals("Incorret no of types", 1, elements.length);
+ IJavaElement element = elements[0];
+ assertEquals("type should be a record", IJavaElement.LOCAL_VARIABLE, element.getElementType());
+ element = element.getParent();
+ assertNotNull("should not be null", element);
+ // unlike constructors whose parameters are explicitly declared,
+ // in case of compact constructors, the element is attached as a child of
+ // the field that represents the record component.
+ assertEquals("should be a method", IJavaElement.FIELD, element.getElementType());
+ }
+ finally {
+ deleteProject("RecordsElement");
+ }
+ }
+ //Test record with canonical constructor
+ public void test006() throws Exception {
+ try {
+ this.workingCopies = new ICompilationUnit[1];
+ IJavaProject project = createJavaProject("RecordsElement");
+ project.open(null);
+ String fileContent = "public record Point(int x1, int x2) {\n" +
+ " public Point(int x1, int x2) {\n" +
+ " this.x1 = x1;\n" +
+ " this.x2 = x2;\n" +
+ " }\n" +
+ "}\n";
+ createFile( "/RecordsElement/src/X.java", fileContent);
+ ICompilationUnit unit = getCompilationUnit("/RecordsElement/src/X.java");
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 1, types.length);
+ assertTrue("type should be a record", types[0].isRecord());
+ assertEquals("type should be a record", IJavaElement.TYPE, types[0].getElementType());
+ IMethod[] methods = types[0].getMethods();
+ assertNotNull("should not be null", methods);
+ assertEquals("Incorret no of elements", 1, methods.length);
+ IMethod constructor = methods[0];
+ assertTrue("should be a constructor", constructor.isConstructor());
+// assertTrue("should be a canonical constructor", constructor.isCanonicalConstructor());
+ assertEquals("incorrect number of parameters", 2, constructor.getNumberOfParameters());
+ String[] parameterNames = constructor.getParameterNames();
+ assertEquals("incorrect numer of names", 2, parameterNames.length);
+ assertEquals("incorrect parameter names", "x1", parameterNames[0]);
+ assertEquals("incorrect parameter names", "x2", parameterNames[1]);
+
+ this.workingCopies[0] = getWorkingCopy("/RecordsElement/src/X.java", fileContent);
+ // Test code select
+ String str = this.workingCopies[0].getSource();
+ String selection = "x1";
+ int start = str.lastIndexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ assertEquals("Incorret no of types", 1, elements.length);
+ IJavaElement element = elements[0];
+ assertEquals("type should be a record", IJavaElement.LOCAL_VARIABLE, element.getElementType());
+ element = element.getParent();
+ assertNotNull("should not be null", element);
+ assertEquals("type should be a method", IJavaElement.METHOD, element.getElementType());
+ }
+ finally {
+ deleteProject("RecordsElement");
+ }
+ }
+ // Test things from a binary
+ public void test007() throws Exception {
+ try {
+ String[] sources = {
+ "p/Point.java",
+ "package p;\n;" +
+ "public record Point(int x1, int x2) {\n" +
+ " public Point(int x1, int x2) {\n" +
+ " this.x1 = x1;\n" +
+ " this.x2 = x2;\n" +
+ " }\n" +
+ " public Point(int x1, int x2, int x3) {\n" +
+ " this(x1, x2);\n" +
+ " }\n" +
+ " public Point(int x1, float f2) {\n" +
+ " this(0, 0);\n" +
+ " }\n" +
+ "}\n"
+ };
+ String outputDirectory = Util.getOutputDirectory();
+
+ String jarPath = outputDirectory + File.separator + "records.jar";
+ Util.createJar(sources, jarPath, "15", true);
+
+ IJavaProject project = createJavaProject("RecordsElement");
+ addClasspathEntry(project, JavaCore.newLibraryEntry(new Path(jarPath), null, null, null, null, false));
+ project.open(null);
+ project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
+ IPackageFragmentRoot root = null;
+ for (IPackageFragmentRoot iRoot : roots) {
+ if (iRoot.getRawClasspathEntry().getPath().toString().endsWith("records.jar")) {
+ root = iRoot;
+ }
+ }
+ assertNotNull("root should not be null", root);
+ IPackageFragment packageFragment = root.getPackageFragment("p");
+ assertNotNull("package is null", packageFragment);
+ IOrdinaryClassFile classFile = packageFragment.getOrdinaryClassFile("Point.class");
+ assertNotNull("class is null", classFile);
+ IType type = classFile.getType();
+ assertNotNull("type is null", type);
+ assertTrue("should be a record", type.isRecord());
+ assertEquals("type should be a record", IJavaElement.TYPE, type.getElementType());
+
+ IField[] fields = type.getFields();
+ assertEquals("Incorret no of fields", 0, fields.length);
+
+ IMethod[] methods = type.getMethods();
+ assertNotNull("should not be null", methods);
+ assertEquals("Incorret no of elements", 8, methods.length); // Point(), Point(), x1(), x2(), toString(), hashCode(), equals()
+ IMethod constructor = methods[0];
+ assertTrue("should be a constructor", constructor.isConstructor());
+// assertTrue("should be a canonical constructor", constructor.isCanonicalConstructor());
+ assertEquals("incorrect number of parameters", 2, constructor.getNumberOfParameters());
+ String[] parameterNames = constructor.getParameterNames();
+ assertEquals("incorrect numer of names", 2, parameterNames.length);
+ assertEquals("incorrect parameter names", "x1", parameterNames[0]);
+ assertEquals("incorrect parameter names", "x2", parameterNames[1]);
+
+ constructor = methods[1];
+ assertTrue("should be a constructor", constructor.isConstructor());
+// assertFalse("should not be a canonical constructor", constructor.isCanonicalConstructor());
+ assertEquals("incorrect number of parameters", 3, constructor.getNumberOfParameters());
+
+ constructor = methods[2];
+ assertTrue("should be a constructor", constructor.isConstructor());
+// assertFalse("should not be a canonical constructor", constructor.isCanonicalConstructor());
+ assertEquals("incorrect number of parameters", 2, constructor.getNumberOfParameters());
+ }
+ finally {
+ deleteProject("RecordsElement");
+ }
+ }
+ // Test things from a binary
+ public void test008() throws Exception {
+ try {
+ String[] sources = {
+ "p/Point.java",
+ "package p;\n;" +
+ "public record Point(int x1, int x2) {\n" +
+ " public Point {\n" +
+ " x1 = 1;\n" +
+ " x2 = 2;\n" +
+ " }\n" +
+ "}\n"
+ };
+ String outputDirectory = Util.getOutputDirectory();
+
+ String jarPath = outputDirectory + File.separator + "records.jar";
+ Util.createJar(sources, jarPath, "15", true);
+
+ IJavaProject project = createJavaProject("RecordsElement");
+ addClasspathEntry(project, JavaCore.newLibraryEntry(new Path(jarPath), null, null, null, null, false));
+ project.open(null);
+ project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
+ IPackageFragmentRoot root = null;
+ for (IPackageFragmentRoot iRoot : roots) {
+ if (iRoot.getRawClasspathEntry().getPath().toString().endsWith("records.jar")) {
+ root = iRoot;
+ }
+ }
+ assertNotNull("root should not be null", root);
+ IPackageFragment packageFragment = root.getPackageFragment("p");
+ assertNotNull("package is null", packageFragment);
+ IOrdinaryClassFile classFile = packageFragment.getOrdinaryClassFile("Point.class");
+ assertNotNull("class is null", classFile);
+ IType type = classFile.getType();
+ assertNotNull("type is null", type);
+ assertTrue("should be a record", type.isRecord());
+ assertEquals("type should be a record", IJavaElement.TYPE, type.getElementType());
+ IMethod[] methods = type.getMethods();
+ assertNotNull("should not be null", methods);
+ assertEquals("Incorret no of elements", 6, methods.length);
+ IMethod constructor = methods[0];
+ assertTrue("should be a constructor", constructor.isConstructor());
+// assertTrue("should be a canonical constructor", constructor.isCanonicalConstructor());
+ assertEquals("incorrect number of parameters", 2, constructor.getNumberOfParameters());
+ String[] parameterNames = constructor.getParameterNames();
+ assertEquals("incorrect numer of names", 2, parameterNames.length);
+ assertEquals("incorrect parameter names", "x1", parameterNames[0]);
+ assertEquals("incorrect parameter names", "x2", parameterNames[1]);
}
finally {
deleteProject("RecordsElement");
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java
index 2274a2c4a6..bb234e8151 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RunJavaSearchTests.java
@@ -67,7 +67,7 @@ public class RunJavaSearchTests extends junit.framework.TestCase {
allClasses.add(JavaSearchBugs9Tests.class);
allClasses.add(JavaSearchBugs10Tests.class);
allClasses.add(JavaSearchBugs13Tests.class);
- allClasses.add(JavaSearchBugs14Tests.class);
+ allClasses.add(JavaSearchBugs15Tests.class);
allClasses.add(JavaSearchMultipleProjectsTests.class);
allClasses.add(SearchTests.class);
allClasses.add(JavaSearchScopeTests.class);
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SealedTypeModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SealedTypeModelTests.java
new file mode 100644
index 0000000000..243c87464e
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SealedTypeModelTests.java
@@ -0,0 +1,391 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.model;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IProblemRequestor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.WorkingCopyOwner;
+import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
+import org.eclipse.jdt.core.tests.util.Util;
+
+import junit.framework.Test;
+
+public class SealedTypeModelTests extends AbstractJavaModelTests {
+
+ static {
+// TESTS_NAMES = new String[] {"test001"};
+ }
+
+ ProblemRequestor problemRequestor;
+ public SealedTypeModelTests(String name) {
+ super(name);
+ }
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ this.problemRequestor = new ProblemRequestor();
+ this.wcOwner = new WorkingCopyOwner() {
+ public IProblemRequestor getProblemRequestor(ICompilationUnit unit) {
+ return SealedTypeModelTests.this.problemRequestor;
+ }
+ };
+ }
+ public static Test suite() {
+ return buildModelTestSuite(AbstractCompilerTest.F_15, SealedTypeModelTests.class);
+ }
+ protected IJavaProject createJavaProject(String projectName) throws CoreException {
+ IJavaProject createJavaProject = super.createJavaProject(projectName, new String[] {"src"}, new String[] {"JCL14_LIB"}, "bin", "15");
+ createJavaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ return createJavaProject;
+ }
+ // Check types with neither sealed nor non-sealed don't return those modifiers
+ public void test001() throws Exception {
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "@SuppressWarnings(\"preview\")\n" +
+ "interface I {}\n" +
+ "public class X implements I {}\n" +
+ "interface Y extends I {}\n";
+
+ createFile( "/SealedTypes/src/X.java", fileContent);
+ ICompilationUnit unit = getCompilationUnit("/SealedTypes/src/X.java");
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 3, types.length);
+ for (IType iType : types) {
+ assertFalse("modifier should not contain sealed : " + iType.getElementName(), iType.isSealed());
+ }
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ public void test002() throws Exception {
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "sealed interface I permits X, Y {}\n" +
+ "public non-sealed class X implements I {}\n" +
+ "non-sealed interface Y extends I {}\n";
+
+ createFile( "/SealedTypes/src/X.java", fileContent);
+ ICompilationUnit unit = getCompilationUnit("/SealedTypes/src/X.java");
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 3, types.length);
+ for (IType iType : types) {
+ if (iType.getElementName().equals("I")) {
+ assertTrue("modifier should contain sealed", iType.isSealed());
+ } else {
+ assertFalse("modifier should not contain sealed : " + iType.getElementName(), iType.isSealed());
+ }
+ }
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test explicitly permitted sub types in Source Type
+ public void test003() throws Exception {
+ String[] permitted = new String[] {"X", "Y"};
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "sealed interface I permits X, Y {}\n" +
+ "public non-sealed class X implements I {}\n" +
+ "non-sealed interface Y extends I {}\n";
+
+ createFile( "/SealedTypes/src/X.java", fileContent);
+ ICompilationUnit unit = getCompilationUnit("/SealedTypes/src/X.java");
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 3, types.length);
+ for (IType iType : types) {
+ if (iType.getElementName().equals("I")) {
+ assertTrue("modifier should contain sealed", iType.isSealed());
+ String[] permittedSubtypeNames = iType.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", permitted.length, permittedSubtypeNames.length);
+ for (int i = 0; i < permitted.length; i++) {
+ assertEquals("incorrect permitted sub type", permitted[i], permittedSubtypeNames[i]);
+ }
+ }
+ }
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test implicitly permitted sub types in Source Type
+ public void test004() throws Exception {
+ String[] permitted = new String[] {"X", "Y"};
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "sealed interface I {}\n" +
+ "public non-sealed class X implements I {}\n" +
+ "non-sealed interface Y extends I {}\n";
+
+ createFile( "/SealedTypes/src/X.java", fileContent);
+ ICompilationUnit unit = getCompilationUnit("/SealedTypes/src/X.java");
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 3, types.length);
+ for (IType iType : types) {
+ if (iType.getElementName().equals("I")) {
+ assertTrue("modifier should contain sealed", iType.isSealed());
+ String[] permittedSubtypeNames = iType.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", permitted.length, permittedSubtypeNames.length);
+ for (int i = 0; i < permitted.length; i++) {
+ assertEquals("incorrect permitted sub type", permitted[i], permittedSubtypeNames[i]);
+ }
+ }
+ }
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test explicitly permitted sub types in binary
+ public void test005() throws Exception {
+ String[] permitted = new String[] {"p.X", "p.Y"};
+ try {
+ String[] sources = {
+ "p/X.java",
+ "package p;\n;" +
+ "sealed interface I permits X, Y {}\n" +
+ "public non-sealed class X implements I {}\n" +
+ "non-sealed interface Y extends I {}\n"
+ };
+ String outputDirectory = Util.getOutputDirectory();
+
+ String jarPath = outputDirectory + File.separator + "sealed.jar";
+ Util.createJar(sources, jarPath, "15", true);
+
+ IJavaProject project = createJavaProject("SealedTypes");
+ addClasspathEntry(project, JavaCore.newLibraryEntry(new Path(jarPath), null, null, null, null, false));
+ project.open(null);
+ project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
+ IPackageFragmentRoot root = null;
+ for (IPackageFragmentRoot iRoot : roots) {
+ if (iRoot.getRawClasspathEntry().getPath().toString().endsWith("sealed.jar")) {
+ root = iRoot;
+ }
+ }
+ assertNotNull("root should not be null", root);
+ IPackageFragment packageFragment = root.getPackageFragment("p");
+ assertNotNull("package is null", packageFragment);
+ IOrdinaryClassFile classFile = packageFragment.getOrdinaryClassFile("I.class");
+ assertNotNull("class is null", classFile);
+ IType type = classFile.getType();
+ assertNotNull("type is null", type);
+ String[] permittedSubtypeNames = type.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", permitted.length, permittedSubtypeNames.length);
+ for (int i = 0; i < permitted.length; i++) {
+ assertEquals("incorrect permitted sub type", permitted[i], permittedSubtypeNames[i]);
+ }
+ assertTrue("modifier should contain sealed", type.isSealed());
+
+ classFile = packageFragment.getOrdinaryClassFile("X.class");
+ assertNotNull("class is null", classFile);
+ type = classFile.getType();
+ assertNotNull("type is null", type);
+ permittedSubtypeNames = type.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", 0, permittedSubtypeNames.length);
+ assertFalse("modifier should not contain sealed", type.isSealed());
+
+ classFile = packageFragment.getOrdinaryClassFile("Y.class");
+ assertNotNull("class is null", classFile);
+ type = classFile.getType();
+ assertNotNull("type is null", type);
+ permittedSubtypeNames = type.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", 0, permittedSubtypeNames.length);
+ assertFalse("modifier should not contain sealed", type.isSealed());
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test implicitly permitted sub types in binary
+ public void test006() throws Exception {
+ String[] permitted = new String[] {"p.X", "p.Y"};
+ try {
+ String[] sources = {
+ "p/X.java",
+ "package p;\n;" +
+ "sealed interface I {}\n" +
+ "public non-sealed class X implements I {}\n" +
+ "non-sealed interface Y extends I {}\n"
+ };
+ String outputDirectory = Util.getOutputDirectory();
+
+ String jarPath = outputDirectory + File.separator + "sealed.jar";
+ Util.createJar(sources, jarPath, "15", true);
+
+ IJavaProject project = createJavaProject("SealedTypes");
+ addClasspathEntry(project, JavaCore.newLibraryEntry(new Path(jarPath), null, null, null, null, false));
+ project.open(null);
+ project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
+ IPackageFragmentRoot root = null;
+ for (IPackageFragmentRoot iRoot : roots) {
+ if (iRoot.getRawClasspathEntry().getPath().toString().endsWith("sealed.jar")) {
+ root = iRoot;
+ }
+ }
+ assertNotNull("root should not be null", root);
+ IPackageFragment packageFragment = root.getPackageFragment("p");
+ assertNotNull("package is null", packageFragment);
+ IOrdinaryClassFile classFile = packageFragment.getOrdinaryClassFile("I.class");
+ assertNotNull("class is null", classFile);
+ IType type = classFile.getType();
+ assertNotNull("type is null", type);
+ String[] permittedSubtypeNames = type.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", permitted.length, permittedSubtypeNames.length);
+ for (int i = 0; i < permitted.length; i++) {
+ assertEquals("incorrect permitted sub type", permitted[i], permittedSubtypeNames[i]);
+ }
+ assertTrue("modifier should contain sealed", type.isSealed());
+
+ classFile = packageFragment.getOrdinaryClassFile("X.class");
+ assertNotNull("class is null", classFile);
+ type = classFile.getType();
+ assertNotNull("type is null", type);
+ permittedSubtypeNames = type.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", 0, permittedSubtypeNames.length);
+ assertFalse("modifier should not contain sealed", type.isSealed());
+
+ classFile = packageFragment.getOrdinaryClassFile("Y.class");
+ assertNotNull("class is null", classFile);
+ type = classFile.getType();
+ assertNotNull("type is null", type);
+ permittedSubtypeNames = type.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", 0, permittedSubtypeNames.length);
+ assertFalse("modifier should not contain sealed", type.isSealed());
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test sealed types for reconciler
+ public void test007() throws Exception {
+ String[] permitted = new String[] {"p.X"};
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "package p;\n" +
+ "sealed interface I permits p.X {}\n";
+ createFolder("/SealedTypes/src/p");
+ createFile("/SealedTypes/src/p/I.java", fileContent);
+ fileContent = "package p;\n" +
+ "public non-sealed class X implements p.I {}\n";
+ createFile( "/SealedTypes/src/p/X.java", fileContent);
+
+ ICompilationUnit unit = getCompilationUnit("/SealedTypes/src/p/I.java");
+
+ this.workingCopies = new ICompilationUnit[1];
+ char[] sourceChars = fileContent.toCharArray();
+ this.problemRequestor.initialize(sourceChars);
+ this.workingCopies[0] = unit.getWorkingCopy(this.wcOwner, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "----------\n",
+ this.problemRequestor);
+
+ IType[] types = unit.getTypes();
+ assertEquals("Incorret no of types", 1, types.length);
+ for (IType iType : types) {
+ if (iType.getElementName().equals("I")) {
+ assertTrue("modifier should contain sealed", iType.isSealed());
+ String[] permittedSubtypeNames = iType.getPermittedSubtypeNames();
+ assertEquals("incorrect permitted sub types", permitted.length, permittedSubtypeNames.length);
+ for (int i = 0; i < permitted.length; i++) {
+ assertEquals("incorrect permitted sub type", permitted[i], permittedSubtypeNames[i]);
+ }
+ }
+ }
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test sealed types for reconciler
+ public void test008() throws Exception {
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "package p;\n" +
+ "sealed interface I permits p.X {}\n";
+ createFolder("/SealedTypes/src/p");
+ createFile( "/SealedTypes/src/p/I.java", fileContent);
+
+ this.workingCopies = new ICompilationUnit[1];
+ char[] sourceChars = fileContent.toCharArray();
+ this.problemRequestor.initialize(sourceChars);
+ this.workingCopies[0] = getCompilationUnit("/SealedTypes/src/p/I.java").getWorkingCopy(this.wcOwner, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "1. ERROR in /SealedTypes/src/p/I.java (at line 2)\n" +
+ " sealed interface I permits p.X {}\n" +
+ " ^^^\n" +
+ "p.X cannot be resolved to a type\n" +
+ "----------\n",
+ this.problemRequestor);
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+ // Test sealed types for reconciler
+ public void test009() throws Exception {
+ try {
+ IJavaProject project = createJavaProject("SealedTypes");
+ project.open(null);
+ String fileContent = "package p;\n" +
+ "sealed interface I permits p.X {}\n";
+ createFolder("/SealedTypes/src/p");
+ createFile( "/SealedTypes/src/p/I.java", fileContent);
+ fileContent = "package p;\n" +
+ "public non-sealed class X {}\n";
+ createFile( "/SealedTypes/src/p/X.java", fileContent);
+
+ this.workingCopies = new ICompilationUnit[1];
+ char[] sourceChars = fileContent.toCharArray();
+ this.problemRequestor.initialize(sourceChars);
+ this.workingCopies[0] = getCompilationUnit("/SealedTypes/src/p/X.java").getWorkingCopy(this.wcOwner, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "1. ERROR in /SealedTypes/src/p/X.java (at line 2)\n" +
+ " public non-sealed class X {}\n" +
+ " ^\n" +
+ "A class X declared as non-sealed should have either a sealed direct superclass or a sealed direct superinterface\n" +
+ "----------\n",
+ this.problemRequestor);
+ }
+ finally {
+ deleteProject("SealedTypes");
+ }
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java
index b730d1c537..7532db71b8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java
@@ -1141,8 +1141,8 @@ public void testSearchPatternCreation37() {
"QUALIFIED_REFERENCE | " +
"THIS_REFERENCE | " +
"IMPLICIT_THIS_REFERENCE | " +
- "METHOD_REFERENCE_EXPRESSION | " + // unused slots
- " | " +
+ "METHOD_REFERENCE_EXPRESSION | " +
+ "PERMITTYPE_TYPE_REFERENCE | " + // unused slots
" | ",
searchPattern);
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInstanceOfPatternExpressionTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInstanceOfPatternExpressionTest.java
index fc1d45a99c..ce33099fa6 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInstanceOfPatternExpressionTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInstanceOfPatternExpressionTest.java
@@ -36,7 +36,7 @@ public class ASTRewritingInstanceOfPatternExpressionTest extends ASTRewritingTes
public ASTRewritingInstanceOfPatternExpressionTest(String name) {
- super(name, 14);
+ super(name, 15);
}
public ASTRewritingInstanceOfPatternExpressionTest(String name, int apiLevel) {
@@ -50,18 +50,18 @@ public class ASTRewritingInstanceOfPatternExpressionTest extends ASTRewritingTes
@Override
protected void setUp() throws Exception {
super.setUp();
- if (this.apiLevel == AST.JLS14 ) {
- this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
- this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
- this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
+ if (this.apiLevel == AST.JLS15 ) {
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
}
}
@SuppressWarnings({ "rawtypes", "deprecation" })
public void test001() throws Exception {
- if (this.apiLevel != 14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
+ if (this.apiLevel != 15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
return;
}
IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordAnnotationsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordAnnotationsTest.java
new file mode 100644
index 0000000000..cdce19879b
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordAnnotationsTest.java
@@ -0,0 +1,1130 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.rewrite.describing;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.*;
+import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
+
+@SuppressWarnings("rawtypes")
+public class ASTRewritingRecordAnnotationsTest extends ASTRewritingTest {
+
+ public ASTRewritingRecordAnnotationsTest(String name) {
+ super(name);
+ }
+ public ASTRewritingRecordAnnotationsTest(String name, int apiLevel) {
+ super(name, apiLevel);
+ }
+
+ public static Test suite() {
+ return createSuite(ASTRewritingRecordAnnotationsTest.class, getAST15());
+ }
+
+ protected static int getAST15() {
+ return AST.JLS15;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (this.apiLevel == AST.JLS15 ) {
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private boolean checkAPILevel() {
+ if (this.apiLevel != 15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
+ return true;
+ }
+ return false;
+ }
+
+ public void testCastAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("public record X() {\n");
+ buf.append(" static String myObject = \"Foo\";\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" String myString = (@Annot String) myObject;\n");
+ buf.append(" String myString1 = (@Annot1 @Annot String) myObject;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo");
+ List statements= methodDeclaration.getBody().statements();
+ {//Add an use of annotation.
+ VariableDeclarationStatement variableDeclarationStatement= (VariableDeclarationStatement) statements.get(0);
+ VariableDeclarationFragment variableDeclarationFragment= (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
+ CastExpression castExpression= (CastExpression) variableDeclarationFragment.getInitializer();
+ SimpleType simpleType= (SimpleType) castExpression.getType();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ VariableDeclarationStatement variableDeclarationStatement= (VariableDeclarationStatement) statements.get(1);
+ VariableDeclarationFragment variableDeclarationFragment= (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
+ CastExpression castExpression= (CastExpression) variableDeclarationFragment.getInitializer();
+ SimpleType simpleType= (SimpleType) castExpression.getType();
+ List annotations = simpleType.annotations();
+ //Remove the use of an Annotation
+ rewrite.remove((ASTNode)annotations.get(1), null);
+ //Replace the use of an Annotation
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.replace((ASTNode)annotations.get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("public record X() {\n");
+ buf.append(" static String myObject = \"Foo\";\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" String myString = (@Annot @Annot2 String) myObject;\n");
+ buf.append(" String myString1 = (@Annot2 String) myObject;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("@java.lang.annotation.Target(value = {ElementType.TYPE_USE})\n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testWildcardTypeArgumentAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper<T>() {\n");
+ buf.append(" }\n");
+ buf.append(" public record Base() {\n");
+ buf.append(" }\n");
+ buf.append(" public static void UnboundedWildcard1 (Helper<@Annot ?> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void UnboundedWildcard2 (Helper<@Annot1 @Annot ?> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void BoundedWildcard1 (Helper<@Annot ? extends Base> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void BoundedWildcard2 (Helper<@Annot1 @Annot ? extends Base> x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ {//Add an use of an annotation.
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "UnboundedWildcard1");
+ List parameters= methodDeclaration.parameters();
+ SingleVariableDeclaration singleVariableDeclaration= (SingleVariableDeclaration) parameters.get(0);
+ ParameterizedType parameterizedType= (ParameterizedType) singleVariableDeclaration.getType();
+ WildcardType wildcardType= (WildcardType) parameterizedType.typeArguments().get(0);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(wildcardType, WildcardType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+
+ methodDeclaration= findMethodDeclaration(type, "BoundedWildcard1");
+ parameters= methodDeclaration.parameters();
+ singleVariableDeclaration= (SingleVariableDeclaration) parameters.get(0);
+ parameterizedType= (ParameterizedType) singleVariableDeclaration.getType();
+ wildcardType= (WildcardType) parameterizedType.typeArguments().get(0);
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(wildcardType, WildcardType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "UnboundedWildcard2");
+ List parameters= methodDeclaration.parameters();
+ SingleVariableDeclaration singleVariableDeclaration= (SingleVariableDeclaration) parameters.get(0);
+ ParameterizedType parameterizedType= (ParameterizedType) singleVariableDeclaration.getType();
+ WildcardType wildcardType= (WildcardType) parameterizedType.typeArguments().get(0);
+
+ methodDeclaration= findMethodDeclaration(type, "BoundedWildcard2");
+ parameters= methodDeclaration.parameters();
+ singleVariableDeclaration= (SingleVariableDeclaration) parameters.get(0);
+ parameterizedType= (ParameterizedType) singleVariableDeclaration.getType();
+ WildcardType wildcardType2= (WildcardType) parameterizedType.typeArguments().get(0);
+
+ //Remove the use of an annotation
+ rewrite.remove((MarkerAnnotation) wildcardType.annotations().get(1), null);
+ rewrite.remove((MarkerAnnotation) wildcardType2.annotations().get(1), null);
+
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ MarkerAnnotation markerAnnotation2= ast.newMarkerAnnotation();
+ markerAnnotation2.setTypeName(ast.newSimpleName("Annot2"));
+
+ //Replace the use of an annotation
+ rewrite.replace((MarkerAnnotation) wildcardType.annotations().get(0), markerAnnotation, null);
+ rewrite.replace((MarkerAnnotation) wildcardType2.annotations().get(0), markerAnnotation2, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper<T>() {\n");
+ buf.append(" }\n");
+ buf.append(" public record Base() {\n");
+ buf.append(" }\n");
+ buf.append(" public static void UnboundedWildcard1 (Helper<@Annot @Annot2 ?> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void UnboundedWildcard2 (Helper<@Annot2 ?> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void BoundedWildcard1 (Helper<@Annot @Annot2 ? extends Base> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void BoundedWildcard2 (Helper<@Annot2 ? extends Base> x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testWildcardBoudAnnotation() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper<T>() {\n");
+ buf.append(" }\n");
+ buf.append(" public record Base() {\n");
+ buf.append(" }\n");
+ buf.append(" public static void foo1 (Helper<? extends @Annot Base> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void foo2 (Helper<? extends @Annot1 @Annot Base> x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ {
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo1");
+ List parameters= methodDeclaration.parameters();
+ SingleVariableDeclaration singleVariableDeclaration= (SingleVariableDeclaration) parameters.get(0);
+ ParameterizedType parameterizedType= (ParameterizedType) singleVariableDeclaration.getType();
+ WildcardType wildcardType= (WildcardType) parameterizedType.typeArguments().get(0);
+ SimpleType simpleType= (SimpleType) wildcardType.getBound();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo2");
+ List parameters= methodDeclaration.parameters();
+ SingleVariableDeclaration singleVariableDeclaration= (SingleVariableDeclaration) parameters.get(0);
+ ParameterizedType parameterizedType= (ParameterizedType) singleVariableDeclaration.getType();
+ WildcardType wildcardType= (WildcardType) parameterizedType.typeArguments().get(0);
+ SimpleType simpleType= (SimpleType) wildcardType.getBound();
+ //Remove the use of annotation
+ rewrite.remove((MarkerAnnotation) simpleType.annotations().get(1), null);
+ //Replace the use of annotation
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.replace((MarkerAnnotation) simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper<T>() {\n");
+ buf.append(" }\n");
+ buf.append(" public record Base() {\n");
+ buf.append(" }\n");
+ buf.append(" public static void foo1 (Helper<? extends @Annot @Annot2 Base> x) {\n");
+ buf.append(" }\n");
+ buf.append(" public static void foo2 (Helper<? extends @Annot2 Base> x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testTypeParameterBoundAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Base() {\n");
+ buf.append(" }\n");
+ buf.append(" public <X extends @Annot Base> void foo1 (X x) {\n");
+ buf.append(" }\n");
+ buf.append(" public <X extends @Annot1 @Annot Base> void foo2 (X x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ {//Add an use of annotation
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo1");
+ TypeParameter typeParameter= (TypeParameter) methodDeclaration.typeParameters().get(0);
+ SimpleType simpleType= (SimpleType) typeParameter.typeBounds().get(0);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo2");
+ TypeParameter typeParameter= (TypeParameter) methodDeclaration.typeParameters().get(0);
+ SimpleType simpleType= (SimpleType) typeParameter.typeBounds().get(0);
+ //Remove an use of annotation
+ rewrite.remove((MarkerAnnotation) simpleType.annotations().get(1), null);
+ //Replace an use of annotation
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.replace((MarkerAnnotation) simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Base() {\n");
+ buf.append(" }\n");
+ buf.append(" public <X extends @Annot @Annot2 Base> void foo1 (X x) {\n");
+ buf.append(" }\n");
+ buf.append(" public <X extends @Annot2 Base> void foo2 (X x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testTypeArgumentsParameterizedClassesAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper <T1, T2>() {\n");
+ buf.append(" }\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper<@Annot String, @Annot @Annot1 String> x;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo");
+ List statements= methodDeclaration.getBody().statements();
+ VariableDeclarationStatement variableDeclarationStatement= (VariableDeclarationStatement) statements.get(0);
+ ParameterizedType parameterizedType= (ParameterizedType) variableDeclarationStatement.getType();
+ {// Add an use of annotation
+ SimpleType simpleType= (SimpleType) parameterizedType.typeArguments().get(0);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ //Replace an use of an annotation
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot3"));
+ rewrite.replace((ASTNode) simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ {
+ SimpleType simpleType= (SimpleType) parameterizedType.typeArguments().get(1);
+ //Remove an use of an annotation
+ rewrite.remove((ASTNode) simpleType.annotations().get(1), null);
+ //Empty annotations list
+ rewrite.remove((ASTNode) simpleType.annotations().get(0), null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper <T1, T2>() {\n");
+ buf.append(" }\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper<@Annot3 @Annot2 String, String> x;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testTypeArgumentsMethodInvocation() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Bar() {\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" public record Helper() {\n");
+ buf.append(" public <T> void foo() {\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" public void zoo() {\n");
+ buf.append(" Helper o = new Helper();\n");
+ buf.append(" o.<@Annot Bar>foo();\n");
+ buf.append(" o.<@Annot @Annot1 Bar>foo();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration = findMethodDeclaration(type, "zoo");
+ List statemList = methodDeclaration.getBody().statements();
+ {// Add an use of an annotation
+ ExpressionStatement expression= (ExpressionStatement) statemList.get(1);
+ MethodInvocation methodInvocation= (MethodInvocation) expression.getExpression();
+ SimpleType simpleType = (SimpleType) methodInvocation.typeArguments().get(0);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ ExpressionStatement expression= (ExpressionStatement) statemList.get(2);
+ MethodInvocation methodInvocation= (MethodInvocation) expression.getExpression();
+ SimpleType simpleType = (SimpleType) methodInvocation.typeArguments().get(0);
+ rewrite.remove((MarkerAnnotation)simpleType.annotations().get(1), null);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.replace((MarkerAnnotation)simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Bar() {\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" public record Helper() {\n");
+ buf.append(" public <T> void foo() {\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" public void zoo() {\n");
+ buf.append(" Helper o = new Helper();\n");
+ buf.append(" o.<@Annot @Annot2 Bar>foo();\n");
+ buf.append(" o.<@Annot2 Bar>foo();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testClassInheritenceAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public interface Helper<T> {\n");
+ buf.append(" }\n");
+ buf.append(" public class Foo1<T> implements @Annot Helper<T> {\n");
+ buf.append(" }\n");
+ buf.append(" public class Foo2<T> implements @Annot @Annot1 Helper<T> {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ {//Add the use of an annotation
+ TypeDeclaration typeDeclaration= (TypeDeclaration) type.bodyDeclarations().get(1);
+ ParameterizedType parameterizedType= (ParameterizedType) typeDeclaration.superInterfaceTypes().get(0);
+ SimpleType simpleType= (SimpleType) parameterizedType.getType();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ TypeDeclaration typeDeclaration= (TypeDeclaration) type.bodyDeclarations().get(2);
+ ParameterizedType parameterizedType= (ParameterizedType) typeDeclaration.superInterfaceTypes().get(0);
+ SimpleType simpleType= (SimpleType) parameterizedType.getType();
+ //Remove the use of an annotation
+ rewrite.remove((MarkerAnnotation) simpleType.annotations().get(1), null);
+ //Replace the use of an annotation
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.replace((MarkerAnnotation) simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public interface Helper<T> {\n");
+ buf.append(" }\n");
+ buf.append(" public class Foo1<T> implements @Annot @Annot2 Helper<T> {\n");
+ buf.append(" }\n");
+ buf.append(" public class Foo2<T> implements @Annot2 Helper<T> {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testTypeTests() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper() {\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper a = new @Annot Helper();\n");
+ buf.append(" boolean x = true;\n");
+ buf.append(" x = a instanceof @Annot Helper;\n");
+ buf.append(" x = a instanceof @Annot @Annot1 Helper;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo");
+ {//Add an use of annotation
+ ExpressionStatement expressionStatement= (ExpressionStatement) methodDeclaration.getBody().statements().get(2);
+ Assignment assignment= (Assignment) expressionStatement.getExpression();
+ InstanceofExpression instanceofExpression= (InstanceofExpression) assignment.getRightHandSide();
+ SimpleType simpleType = (SimpleType) instanceofExpression.getRightOperand();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ ExpressionStatement expressionStatement= (ExpressionStatement) methodDeclaration.getBody().statements().get(3);
+ Assignment assignment= (Assignment) expressionStatement.getExpression();
+ InstanceofExpression instanceofExpression= (InstanceofExpression) assignment.getRightHandSide();
+ SimpleType simpleType = (SimpleType) instanceofExpression.getRightOperand();
+ //Remove an use of annotation
+ rewrite.remove((MarkerAnnotation) simpleType.annotations().get(1), null);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ //Replace an use of annotation
+ rewrite.replace((MarkerAnnotation) simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper() {\n");
+ buf.append(" }\n");
+ buf.append(" \n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper a = new @Annot Helper();\n");
+ buf.append(" boolean x = true;\n");
+ buf.append(" x = a instanceof @Annot @Annot2 Helper;\n");
+ buf.append(" x = a instanceof @Annot2 Helper;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testConstructorInvocation() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append(" \n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper() {\n");
+ buf.append(" } \n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper obj = new @Annot Helper();\n");
+ buf.append(" obj = new @Annot @Annot1 Helper();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo");
+ List statements= methodDeclaration.getBody().statements();
+ {//Add an use of annotation
+ VariableDeclarationStatement variableDeclarationStatement= (VariableDeclarationStatement) statements.get(0);
+ VariableDeclarationFragment variableDeclarationFragment= (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
+ ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) variableDeclarationFragment.getInitializer();
+ SimpleType simpleType = (SimpleType) classInstanceCreation.getType();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ ExpressionStatement expressionStatement= (ExpressionStatement) methodDeclaration.getBody().statements().get(1);
+ Assignment assignment= (Assignment) expressionStatement.getExpression();
+ ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) assignment.getRightHandSide();
+ SimpleType simpleType = (SimpleType) classInstanceCreation.getType();
+ //Remove an use of annotation
+ rewrite.remove((MarkerAnnotation) simpleType.annotations().get(1), null);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ //Replace an use of annotation
+ rewrite.replace((MarkerAnnotation) simpleType.annotations().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append(" \n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper() {\n");
+ buf.append(" } \n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper obj = new @Annot @Annot2 Helper();\n");
+ buf.append(" obj = new @Annot2 Helper();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testConstructorDeclaration() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" @Annot X {\n");
+ buf.append(" }\n");
+ buf.append(" @Annot @Annot1 X (int x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ {//Add the use of annotation
+ MethodDeclaration methodDeclaration= (MethodDeclaration) type.bodyDeclarations().get(0);
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(methodDeclaration, MethodDeclaration.MODIFIERS2_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ {
+ //Remove the use of annotation
+ MethodDeclaration methodDeclaration= (MethodDeclaration) type.bodyDeclarations().get(1);
+ rewrite.remove((MarkerAnnotation) methodDeclaration.modifiers().get(1), null);
+ //Replace the use of annotation
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.replace((MarkerAnnotation) methodDeclaration.modifiers().get(0), markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" @Annot\n");
+ buf.append(" @Annot2 X {\n");
+ buf.append(" }\n");
+ buf.append(" @Annot2 X (int x) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE)\n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testRewriteInsertAPIAnnotation() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper <T1, T2>() {\n");
+ buf.append(" }\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper<@Annot @Annot1 String> x;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo");
+ List statements= methodDeclaration.getBody().statements();
+ VariableDeclarationStatement variableDeclarationStatement= (VariableDeclarationStatement) statements.get(0);
+ ParameterizedType parameterizedType= (ParameterizedType) variableDeclarationStatement.getType();
+ {
+ SimpleType simpleType= (SimpleType) parameterizedType.typeArguments().get(0);
+ //Insert first
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot2"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertFirst(markerAnnotation, null);
+
+ //InsertAt
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot3"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertAt(markerAnnotation, 1, null);
+
+ //Insert after
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot4"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertAfter(markerAnnotation, (MarkerAnnotation) simpleType.annotations().get(1), null);
+
+ //Insert before
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot5"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertBefore(markerAnnotation, (MarkerAnnotation) simpleType.annotations().get(1), null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf = new StringBuffer();
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("\n");
+ buf.append("public record X() {\n");
+ buf.append(" public record Helper <T1, T2>() {\n");
+ buf.append(" }\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" Helper<@Annot2 @Annot3 @Annot @Annot5 @Annot1 @Annot4 String> x;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot {}\n");
+ buf.append("\n");
+ buf.append("@java.lang.annotation.Target (ElementType.TYPE_USE) \n");
+ buf.append("@interface Annot1 {}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testEmptyListInsertAnnotation() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public record X() {\n");
+ buf.append(" static String myObject = \"Foo\";\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" String myString = (String) myObject;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration type= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(type, "foo");
+ List statements= methodDeclaration.getBody().statements();
+ {//Add an use of annotation.
+ VariableDeclarationStatement variableDeclarationStatement= (VariableDeclarationStatement) statements.get(0);
+ VariableDeclarationFragment variableDeclarationFragment= (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
+ CastExpression castExpression= (CastExpression) variableDeclarationFragment.getInitializer();
+ SimpleType simpleType= (SimpleType) castExpression.getType();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Annot"));
+ rewrite.getListRewrite(simpleType, SimpleType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public record X() {\n");
+ buf.append(" static String myObject = \"Foo\";\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" String myString = (@Annot String) myObject;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testNameQualifiedTypeAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test406469.bug", false, null);
+ String contents = "package test406469.bug;\n" +
+ "import java.lang.annotation.*;\n" +
+ "public record X() {\n" +
+ " @Target(ElementType.TYPE_USE)\n" +
+ " @Retention(RetentionPolicy.RUNTIME)\n" +
+ " @Documented\n" +
+ " static @interface NonNull { }\n" +
+ " class Inner {}\n" +
+ " \n" +
+ " /**\n" +
+ " * @param arg \n" +
+ " */\n" +
+ " test406469.bug.@NonNull IOException foo(\n" +
+ " test406469.bug.@NonNull FileNotFoundException arg)\n" +
+ " throws test406469.bug.@NonNull EOFException {\n" +
+ " try {\n" +
+ " test406469.bug.@NonNull IOError e = new test406469.bug.IOError();\n" +
+ " throw e;\n" +
+ " } catch (test406469.bug.@NonNull IOError e) {\n" +
+ " }\n" +
+ " return null;\n" +
+ " } \n" +
+ " test406469.bug.@NonNull X.@NonNull Inner fInner;\n" +
+ "} \n" +
+ "@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) @interface Marker {} \n" +
+ "\n" +
+ "class Outer {\n" +
+ " public class Inner {\n" +
+ " public class Deeper {}\n" +
+ " }\n" +
+ "}\n" +
+ "class IOException extends Exception {private static final long serialVersionUID=10001L;}\n" +
+ "class FileNotFoundException extends Exception{private static final long serialVersionUID=10002L;}\n" +
+ "class EOFException extends Exception{private static final long serialVersionUID=10003L;}\n" +
+ "class IOError extends Exception{private static final long serialVersionUID=10004L;}\n";
+ StringBuffer buf = new StringBuffer(contents);
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu, /* resolve */ true, false);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration typeDeclaration= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(typeDeclaration, "foo");
+ { //replace an annotation.
+ NameQualifiedType nameQualifiedType = (NameQualifiedType) methodDeclaration.getReturnType2();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Marker"));
+ rewrite.replace((ASTNode) nameQualifiedType.annotations().get(0), markerAnnotation, null);
+
+ // remove an annotation
+ SingleVariableDeclaration param = (SingleVariableDeclaration) methodDeclaration.parameters().get(0);
+ nameQualifiedType = (NameQualifiedType) param.getType();
+ rewrite.remove((ASTNode) nameQualifiedType.annotations().get(0), null);
+
+ // insert an annotation after an existing annotation
+ nameQualifiedType = (NameQualifiedType) methodDeclaration.thrownExceptionTypes().get(0);
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Marker"));
+ rewrite.getListRewrite(nameQualifiedType, NameQualifiedType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+
+ /* insert an annotation in a type not converted as a NameQualifiedType. This would involve
+ * creation of a NameQualifiedType from fields of the existing type.
+ */
+ TryStatement tryStatement = (TryStatement) methodDeclaration.getBody().statements().get(0);
+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) tryStatement.getBody().statements().get(0);
+ VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
+ ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) variableDeclarationFragment.getInitializer();
+ SimpleType simpleType = (SimpleType) classInstanceCreation.getType();
+ QualifiedName qualifiedName = (QualifiedName) simpleType.getName();
+ SimpleName simpleName = ast.newSimpleName(qualifiedName.getName().getIdentifier());
+ qualifiedName = (QualifiedName) qualifiedName.getQualifier();
+ qualifiedName = ast.newQualifiedName(ast.newName(qualifiedName.getQualifier().toString()), ast.newSimpleName(qualifiedName.getName().toString()));
+ nameQualifiedType = ast.newNameQualifiedType(qualifiedName, simpleName);
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("Marker"));
+ rewrite.getListRewrite(nameQualifiedType, NameQualifiedType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ rewrite.replace(classInstanceCreation.getType(), nameQualifiedType, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ String contentsmodified = "package test406469.bug;\n" +
+ "import java.lang.annotation.*;\n" +
+ "public record X() {\n" +
+ " @Target(ElementType.TYPE_USE)\n" +
+ " @Retention(RetentionPolicy.RUNTIME)\n" +
+ " @Documented\n" +
+ " static @interface NonNull { }\n" +
+ " class Inner {}\n" +
+ " \n" +
+ " /**\n" +
+ " * @param arg \n" +
+ " */\n" +
+ " test406469.bug.@Marker IOException foo(\n" +
+ " test406469.bug.FileNotFoundException arg)\n" +
+ " throws test406469.bug.@NonNull @Marker EOFException {\n" +
+ " try {\n" +
+ " test406469.bug.@NonNull IOError e = new test406469.bug.@Marker IOError();\n" +
+ " throw e;\n" +
+ " } catch (test406469.bug.@NonNull IOError e) {\n" +
+ " }\n" +
+ " return null;\n" +
+ " } \n" +
+ " test406469.bug.@NonNull X.@NonNull Inner fInner;\n" +
+ "} \n" +
+ "@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) @interface Marker {} \n" +
+ "\n" +
+ "class Outer {\n" +
+ " public class Inner {\n" +
+ " public class Deeper {}\n" +
+ " }\n" +
+ "}\n" +
+ "class IOException extends Exception {private static final long serialVersionUID=10001L;}\n" +
+ "class FileNotFoundException extends Exception{private static final long serialVersionUID=10002L;}\n" +
+ "class EOFException extends Exception{private static final long serialVersionUID=10003L;}\n" +
+ "class IOError extends Exception{private static final long serialVersionUID=10004L;}\n";
+ assertEqualString(preview, contentsmodified);
+ }
+
+ public void testQualifiedTypeAnnotations() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test407364.bug", false, null);
+ String contents = "package test0002;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "public record X() {\n" +
+ " public static void main(String[] args) {\n" +
+ " Outer outer = new Outer();\n" +
+ " Outer.@Marker1 Inner first = outer.new Inner();\n" +
+ " Outer.@Marker2 Inner second = outer.new Inner() ;\n" +
+ " Outer.Inner.@Marker1 Deeper deeper = second.new Deeper();\n" +
+ " Outer.Inner.Deeper deeper2 = second.new Deeper();\n" +
+ " }\n" + "}\n" + "class Outer {\n" +
+ " public class Inner {\n" +
+ " public class Deeper {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker {}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker1 {}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker2 {}\n";
+
+ StringBuffer buf = new StringBuffer(contents);
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+ CompilationUnit astRoot= createAST(cu, /* resolve */ true, false);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+ AST ast= astRoot.getAST();
+ RecordDeclaration typeDeclaration= (RecordDeclaration)findAbstractTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDeclaration= findMethodDeclaration(typeDeclaration, "main");
+ List statements = methodDeclaration.getBody().statements();
+ int sCount = 1;
+
+ { //replace an annotation.
+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statements.get(sCount++);
+ NameQualifiedType nameQualifiedType = (NameQualifiedType) variableDeclarationStatement.getType();
+ MarkerAnnotation markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("NewMarker"));
+ rewrite.replace((ASTNode) nameQualifiedType.annotations().get(0), markerAnnotation, null);
+
+ // remove an annotation
+ variableDeclarationStatement = (VariableDeclarationStatement) statements.get(sCount++);
+ nameQualifiedType = (NameQualifiedType) variableDeclarationStatement.getType();
+ rewrite.remove((ASTNode) nameQualifiedType.annotations().get(0), null);
+
+ // insert an annotation after an existing annotation
+ variableDeclarationStatement = (VariableDeclarationStatement) statements.get(sCount++);
+ nameQualifiedType = (NameQualifiedType) variableDeclarationStatement.getType();
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("NewMarker"));
+ rewrite.getListRewrite(nameQualifiedType, NameQualifiedType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+
+ /* insert an annotation in a type not converted as QualifiedType. This would involve
+ * creation of a QualifiedType from fields of the existing type.
+ */
+ variableDeclarationStatement = (VariableDeclarationStatement) statements.get(sCount++);
+ SimpleType simpleType = (SimpleType) variableDeclarationStatement.getType();
+ QualifiedName qualifiedName = (QualifiedName) simpleType.getName();
+ SimpleName simpleName = ast.newSimpleName(qualifiedName.getName().getIdentifier());
+ qualifiedName = (QualifiedName) qualifiedName.getQualifier();
+ qualifiedName = ast.newQualifiedName(ast.newName(qualifiedName.getQualifier().toString()), ast.newSimpleName(qualifiedName.getName().toString()));
+ nameQualifiedType = ast.newNameQualifiedType(qualifiedName, simpleName);
+
+ markerAnnotation= ast.newMarkerAnnotation();
+ markerAnnotation.setTypeName(ast.newSimpleName("NewMarker"));
+ rewrite.getListRewrite(nameQualifiedType, NameQualifiedType.ANNOTATIONS_PROPERTY).insertLast(markerAnnotation, null);
+ rewrite.replace(variableDeclarationStatement.getType(), nameQualifiedType, null);
+ }
+ String preview= evaluateRewrite(cu, rewrite);
+ String contentsmodified = "package test0002;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "public record X() {\n" +
+ " public static void main(String[] args) {\n" +
+ " Outer outer = new Outer();\n" +
+ " Outer.@NewMarker Inner first = outer.new Inner();\n" +
+ " Outer.Inner second = outer.new Inner() ;\n" +
+ " Outer.Inner.@Marker1 @NewMarker Deeper deeper = second.new Deeper();\n" +
+ " Outer.Inner.@NewMarker Deeper deeper2 = second.new Deeper();\n" +
+ " }\n" + "}\n" + "class Outer {\n" +
+ " public class Inner {\n" +
+ " public class Deeper {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker {}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker1 {}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker2 {}\n";
+ assertEqualString(preview, contentsmodified);
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordDeclarationTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordDeclarationTest.java
index f74971dac7..a2d3481130 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordDeclarationTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordDeclarationTest.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
-* This is an implementation of an early-draft specification developed under the Java
-* Community Process (JCP) and is made available for testing and evaluation purposes
-* only. The code is not compatible with any specification of the JCP.
-*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -29,6 +25,7 @@ import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ExpressionStatement;
import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.Modifier;
@@ -52,7 +49,7 @@ import junit.framework.Test;
public class ASTRewritingRecordDeclarationTest extends ASTRewritingTest {
public ASTRewritingRecordDeclarationTest(String name) {
- super(name, 14);
+ super(name, 15);
}
public ASTRewritingRecordDeclarationTest(String name, int apiLevel) {
@@ -66,18 +63,18 @@ public class ASTRewritingRecordDeclarationTest extends ASTRewritingTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- if (this.apiLevel == AST.JLS14 ) {
- this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
- this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
- this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
+ if (this.apiLevel == AST.JLS15 ) {
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
}
}
@SuppressWarnings("deprecation")
private boolean checkAPILevel() {
- if (this.apiLevel != 14) {
- System.err.println("Test "+getName()+" requires a JRE 14");
+ if (this.apiLevel != 15) {
+ System.err.println("Test "+getName()+" requires a JRE 15");
return true;
}
return false;
@@ -1141,7 +1138,6 @@ public class ASTRewritingRecordDeclarationTest extends ASTRewritingTest {
assertTrue("Not a record", type instanceof RecordDeclaration);
RecordDeclaration record = (RecordDeclaration)type;
{ // change parameter type
- //rewrite.set((TypeParameter) record.typeParameters().get(0), TypeParameter.NAME_PROPERTY, astRoot.getAST().newSimpleName("Y"), null);
ListRewrite listRewrite= rewrite.getListRewrite(record, RecordDeclaration.TYPE_PARAMETERS_PROPERTY);
TypeParameter typeParameter= ast.newTypeParameter();
typeParameter.setName(ast.newSimpleName("Y"));
@@ -1212,6 +1208,175 @@ public class ASTRewritingRecordDeclarationTest extends ASTRewritingTest {
}
+ @SuppressWarnings("rawtypes")
+ public void testRecord_025() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("import java.lang.annotation.Target;\n");
+ buf.append("record X(@MyAnnot int lo) {\n");
+ buf.append(" public int lo() {\n");
+ buf.append(" return this.lo;\\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@Target({ElementType.FIELD})\n");
+ buf.append("@interface MyAnnot {}");
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ AbstractTypeDeclaration type= findAbstractTypeDeclaration(astRoot, "X");
+ assertTrue("Not a record", type instanceof RecordDeclaration);
+ RecordDeclaration record = (RecordDeclaration)type;
+ {
+ List recordComponents = record.recordComponents();
+ assertTrue("must be 1 parameter", recordComponents.size() == 1);
+ SingleVariableDeclaration recordComp = (SingleVariableDeclaration)recordComponents.get(0);
+ // remove annotation
+ ListRewrite listRewrite= rewrite.getListRewrite(recordComp, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
+ listRewrite.remove((MarkerAnnotation)(recordComp.modifiers().get(0)), null);
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("import java.lang.annotation.Target;\n");
+ buf.append("record X(int lo) {\n");
+ buf.append(" public int lo() {\n");
+ buf.append(" return this.lo;\\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@Target({ElementType.FIELD})\n");
+ buf.append("@interface MyAnnot {}");
+
+ assertEqualString(preview, buf.toString());
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testRecord_026() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("import java.lang.annotation.Target;\n");
+ buf.append("record X(@MyAnnot int lo) {\n");
+ buf.append(" public int lo() {\n");
+ buf.append(" return this.lo;\\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@Target({ElementType.FIELD})\n");
+ buf.append("@interface MyAnnot {}");
+ buf.append("@Target({ElementType.RECORD_COMPONENT})\n");
+ buf.append("@interface MyAnnotNew {}");
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ AbstractTypeDeclaration type= findAbstractTypeDeclaration(astRoot, "X");
+ assertTrue("Not a record", type instanceof RecordDeclaration);
+ RecordDeclaration record = (RecordDeclaration)type;
+ AST ast= astRoot.getAST();
+ {
+ List recordComponents = record.recordComponents();
+ assertTrue("must be 1 parameter", recordComponents.size() == 1);
+ SingleVariableDeclaration recordComp = (SingleVariableDeclaration)recordComponents.get(0);
+ // modify annotation
+ ListRewrite listRewrite= rewrite.getListRewrite(recordComp, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
+ MarkerAnnotation annot= ast.newMarkerAnnotation();
+ annot.setTypeName(ast.newSimpleName("MyAnnotNew"));
+ listRewrite.replace((MarkerAnnotation)(recordComp.modifiers().get(0)), annot, null);
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("import java.lang.annotation.Target;\n");
+ buf.append("record X(@MyAnnotNew int lo) {\n");
+ buf.append(" public int lo() {\n");
+ buf.append(" return this.lo;\\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@Target({ElementType.FIELD})\n");
+ buf.append("@interface MyAnnot {}");
+ buf.append("@Target({ElementType.RECORD_COMPONENT})\n");
+ buf.append("@interface MyAnnotNew {}");
+
+ assertEqualString(preview, buf.toString());
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testRecord_027() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("import java.lang.annotation.Target;\n");
+ buf.append("record X(int lo) {\n");
+ buf.append(" public int lo() {\n");
+ buf.append(" return this.lo;\\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@Target({ElementType.RECORD_COMPONENT})\n");
+ buf.append("@interface MyAnnot {}");
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ AbstractTypeDeclaration type= findAbstractTypeDeclaration(astRoot, "X");
+ assertTrue("Not a record", type instanceof RecordDeclaration);
+ RecordDeclaration record = (RecordDeclaration)type;
+ AST ast= astRoot.getAST();
+ {
+ List recordComponents = record.recordComponents();
+ assertTrue("must be 1 parameter", recordComponents.size() == 1);
+ SingleVariableDeclaration recordComp = (SingleVariableDeclaration)recordComponents.get(0);
+ // add annotation
+ ListRewrite listRewrite= rewrite.getListRewrite(recordComp, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
+ MarkerAnnotation annot= ast.newMarkerAnnotation();
+ annot.setTypeName(ast.newSimpleName("MyAnnot"));
+ listRewrite.insertFirst(annot, null);
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.lang.annotation.ElementType;\n");
+ buf.append("import java.lang.annotation.Target;\n");
+ buf.append("record X(@MyAnnot int lo) {\n");
+ buf.append(" public int lo() {\n");
+ buf.append(" return this.lo;\\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ buf.append("@Target({ElementType.RECORD_COMPONENT})\n");
+ buf.append("@interface MyAnnot {}");
+
+ assertEqualString(preview, buf.toString());
+
+ }
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
index 3e53f561e9..96cecfa211 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -107,7 +107,7 @@ public class ASTRewritingStatementsTest extends ASTRewritingTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- if (this.apiLevel == AST.JLS14 ) {
+ if (this.apiLevel == AST_INTERNAL_JLS15 ) {
this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
index 88887256a2..7f8617982c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
@@ -55,10 +55,15 @@ public class ASTRewritingSwitchExpressionsTest extends ASTRewritingTest {
return createSuite(ASTRewritingSwitchExpressionsTest.class);
}
+ @SuppressWarnings("deprecation")
@Override
protected void setUp() throws Exception {
super.setUp();
- if (this.apiLevel == AST.JLS14 ) {
+ if (this.apiLevel == AST_INTERNAL_JLS15 ) {
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ } else if (this.apiLevel == AST_INTERNAL_JLS14 ) {
this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
@@ -229,6 +234,9 @@ public class ASTRewritingSwitchExpressionsTest extends ASTRewritingTest {
@SuppressWarnings("rawtypes")
public void testSwitchExpressions_03_since_12() throws Exception {
+ /*
+ * if (this.apiLevel == AST_INTERNAL_JLS15) { return; }
+ */
IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
String s =
"package test1;\n"+
@@ -398,6 +406,9 @@ public class ASTRewritingSwitchExpressionsTest extends ASTRewritingTest {
}
@SuppressWarnings("rawtypes")
public void testSwitchExpressions_04_since_12() throws Exception {
+ /*
+ * if (this.apiLevel == AST_INTERNAL_JLS15) { return; }
+ */
IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
String s = "package test1;\n"+
"public class X {\n"+
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
index 989080390f..3db4b5ea47 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
@@ -84,9 +84,12 @@ public class ASTRewritingTest extends AbstractJavaModelTests {
/** @deprecated using deprecated code */
private final static int JLS10_INTERNAL = AST.JLS10;
+ /** @deprecated using deprecated code */
private final static int JLS14_INTERNAL = AST.JLS14;
- private final static int[] JLS_LEVELS = { JLS2_INTERNAL, JLS3_INTERNAL, JLS4_INTERNAL, JLS8_INTERNAL, JLS9_INTERNAL, JLS10_INTERNAL, JLS14_INTERNAL };
+ private final static int JLS15_INTERNAL = AST.JLS15;
+
+ private final static int[] JLS_LEVELS = { JLS2_INTERNAL, JLS3_INTERNAL, JLS4_INTERNAL, JLS8_INTERNAL, JLS9_INTERNAL, JLS10_INTERNAL, JLS14_INTERNAL, JLS15_INTERNAL};
private static final String ONLY_AST_STRING = "_only";
private static final String SINCE_AST_STRING = "_since";
@@ -148,7 +151,7 @@ public class ASTRewritingTest extends AbstractJavaModelTests {
suite.addTest(SourceModifierTest.suite());
suite.addTest(ImportRewriteTest.suite());
suite.addTest(ImportRewrite18Test.suite());
- suite.addTest(ImportRewrite14Test.suite());
+ suite.addTest(ImportRewrite_15Test.suite());
return suite;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
index 6e0fc5b876..0602c288ef 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,8 +15,6 @@ package org.eclipse.jdt.core.tests.rewrite.describing;
import java.util.List;
-import junit.framework.Test;
-
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
@@ -33,12 +31,13 @@ import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor;
import org.eclipse.jdt.core.dom.ChildPropertyDescriptor;
import org.eclipse.jdt.core.dom.ClassInstanceCreation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Dimension;
import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.eclipse.jdt.core.dom.Dimension;
import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.ImportDeclaration;
import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MethodDeclaration;
@@ -49,6 +48,7 @@ import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimplePropertyDescriptor;
+import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.StringLiteral;
@@ -61,7 +61,8 @@ import org.eclipse.jdt.core.dom.WildcardType;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
-import org.eclipse.jdt.core.dom.ITypeBinding;
+
+import junit.framework.Test;
@SuppressWarnings({"rawtypes", "unchecked"})
public class ASTRewritingTypeDeclTest extends ASTRewritingTest {
@@ -2041,4 +2042,512 @@ public class ASTRewritingTypeDeclTest extends ASTRewritingTest {
assertEqualString(preview, buf.toString());
}
+ @SuppressWarnings("deprecation")
+ private boolean checkAPILevel(int level) {
+ if (this.apiLevel != level) {
+ System.err.println("Test "+getName()+" requires a JRE " + level);
+ return true;
+ }
+ return false;
+ }
+
+ public void testSealedModifier_001() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // add 1 permits
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ SimpleType newPermits= ast.newSimpleType(ast.newSimpleName("C2"));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1, C2{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+
+ public void testSealedModifier_002() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1, C2 {\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("final class C1 extends C{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // remove permits
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ List permittedTypes = typeC.permittedTypes();
+ listRewrite2.remove((SimpleType)permittedTypes.get(1), null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1 {\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("final class C1 extends C{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testSealedModifier_003() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class C {\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("class C1 extends C{}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // add sealed and permits
+ ListRewrite listRewrite= rewrite.getListRewrite(typeC, TypeDeclaration.MODIFIERS2_PROPERTY);
+ listRewrite.insertLast(ast.newModifier(Modifier.ModifierKeyword.SEALED_KEYWORD), null);
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ SimpleType newPermits= ast.newSimpleType(ast.newSimpleName("C1"));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1 {\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("class C1 extends C{}\n");
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testSealedModifier_004() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1{}\n");
+ buf.append("final class C1 extends C{}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // remove last permit
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ List permittedTypes = typeC.permittedTypes();
+ listRewrite2.remove((SimpleType)permittedTypes.get(0), null);
+
+ // remove sealed
+ ListRewrite listRewrite= rewrite.getListRewrite(typeC, TypeDeclaration.MODIFIERS2_PROPERTY);
+ List modifiers = typeC.modifiers();
+ listRewrite.remove((Modifier)modifiers.get(1), null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class C{}\n");
+ buf.append("final class C1 extends C{}\n");
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testSealedModifier_005() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // replace permits
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ List permittedTypes = typeC.permittedTypes();
+ listRewrite2.remove((SimpleType)permittedTypes.get(0), null);
+ SimpleType newPermits= ast.newSimpleType(ast.newSimpleName("C2"));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+
+ TypeDeclaration typeC1= findTypeDeclaration(astRoot, "C1");
+ {
+ // remove non-sealed
+ ListRewrite listRewrite= rewrite.getListRewrite(typeC1, TypeDeclaration.MODIFIERS2_PROPERTY);
+ List modifiers = typeC1.modifiers();
+ listRewrite.remove((Modifier)modifiers.get(0), null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C2{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("class C1 extends C{}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testSealedModifier_006() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C3{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C3 extends C{}\n");
+ buf.append("class C1{\n");
+ buf.append("final class C2 extends C{}\n");
+ buf.append("}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // add permits for inner class
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ SimpleType newPermits= ast.newSimpleType(ast.newQualifiedName(ast.newName("C1"), ast.newSimpleName("C2")));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C3, C1.C2{\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C3 extends C{}\n");
+ buf.append("class C1{\n");
+ buf.append("final class C2 extends C{}\n");
+ buf.append("}\n");
+
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
+ public void testSealedModifier_007() throws Exception {
+
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1 //comment\n");
+ buf.append("{\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+
+ { // add 1 more permits
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ SimpleType newPermits= ast.newSimpleType(ast.newSimpleName("C2"));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C permits C1 //comment\n");
+ buf.append(", C2\n");
+ buf.append("{\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ buf.append("non-sealed class C2 extends C{}\n");
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testSealedModifier_008() throws Exception {
+
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class C//comment\n");
+ buf.append("{\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+
+ { // add 1 permits
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ SimpleType newPermits= ast.newSimpleType(ast.newSimpleName("C1"));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+ { // add sealed
+ ListRewrite listRewrite= rewrite.getListRewrite(typeC, TypeDeclaration.MODIFIERS2_PROPERTY);
+ listRewrite.insertLast(ast.newModifier(Modifier.ModifierKeyword.SEALED_KEYWORD), null);
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C//comment\n");
+ buf.append(" permits C1\n");
+ buf.append("{\n");
+ buf.append("}\n");
+ buf.append("non-sealed class C1 extends C{}\n");
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+ public void testSealedModifier_009() throws Exception {
+ if (checkAPILevel(15)) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class C implements B {\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("class C1 extends C{}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ String old = this.project1.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ CompilationUnit astRoot= createAST(cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration typeC= findTypeDeclaration(astRoot, "C");
+ { // add sealed and permits
+ ListRewrite listRewrite= rewrite.getListRewrite(typeC, TypeDeclaration.MODIFIERS2_PROPERTY);
+ listRewrite.insertLast(ast.newModifier(Modifier.ModifierKeyword.SEALED_KEYWORD), null);
+
+ ListRewrite listRewrite2= rewrite.getListRewrite(typeC, TypeDeclaration.PERMITS_TYPES_PROPERTY);
+ SimpleType newPermits= ast.newSimpleType(ast.newSimpleName("C1"));
+ listRewrite2.insertLast(newPermits, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public sealed class C implements B permits C1 {\n");
+ buf.append("\n");
+ buf.append("}\n");
+ buf.append("class C1 extends C{}\n");
+
+ assertEqualString(preview, buf.toString());
+ }finally {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+
+ }
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewrite14Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewrite_15Test.java
index 2d376b862c..4e34f6de83 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewrite14Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewrite_15Test.java
@@ -43,16 +43,16 @@ import junit.framework.Test;
@SuppressWarnings("rawtypes")
-public class ImportRewrite14Test extends AbstractJavaModelTests {
+public class ImportRewrite_15Test extends AbstractJavaModelTests {
- private static final Class THIS= ImportRewrite14Test.class;
+ private static final Class THIS= ImportRewrite_15Test.class;
private static final String PROJECT = "ImportRewrite14TestProject";
protected IPackageFragmentRoot sourceFolder;
- public ImportRewrite14Test(String name) {
+ public ImportRewrite_15Test(String name) {
super(name);
}
@@ -68,13 +68,13 @@ public class ImportRewrite14Test extends AbstractJavaModelTests {
protected void setUp() throws Exception {
super.setUp();
- IJavaProject proj= createJavaProject(PROJECT, new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "14");
+ IJavaProject proj= createJavaProject(PROJECT, new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "15");
proj.setOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
proj.setOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
- proj.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
+ proj.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_15);
proj.setOption(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
- proj.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
- proj.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
+ proj.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_15);
+ proj.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_15);
proj.setOption(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, String.valueOf(99));
proj.setOption(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_IMPORT_GROUPS, String.valueOf(1));
@@ -86,8 +86,11 @@ public class ImportRewrite14Test extends AbstractJavaModelTests {
waitUntilIndexesReady();
}
- protected static int getJLS14() {
- return AST.JLS14;
+ /**
+ * @deprecated uses deprecated AST level
+ */
+ protected static int getJLS15() {
+ return AST.JLS15;
}
@Override
protected void tearDown() throws Exception {
@@ -110,7 +113,7 @@ public class ImportRewrite14Test extends AbstractJavaModelTests {
createFolder("/" + PROJECT + "/src/pack2");
createFile("/" + PROJECT + "/src/pack2/MyAnnotation.java", contents);
- ASTParser parser = ASTParser.newParser(getJLS14());
+ ASTParser parser = ASTParser.newParser(getJLS15());
parser.setSource(getCompilationUnit("/" + PROJECT + "/src/pack2/MyAnnotation.java"));
parser.setResolveBindings(true);
parser.setStatementsRecovery(true);
@@ -162,7 +165,7 @@ public class ImportRewrite14Test extends AbstractJavaModelTests {
createFile("/" + PROJECT + "/src/X.java", contents);
ICompilationUnit cu= getCompilationUnit("/" + PROJECT + "/src/X.java");
- ASTParser parser = ASTParser.newParser(getJLS14());
+ ASTParser parser = ASTParser.newParser(getJLS15());
parser.setSource(cu);
parser.setResolveBindings(true);
parser.setStatementsRecovery(true);
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Converter_15/.classpath
new file mode 100644
index 0000000000..030a6b11f8
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="var" path="CONVERTER_JCL14_LIB" sourcepath="CONVERTER_JCL14_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15/.project b/org.eclipse.jdt.core.tests.model/workspace/Converter_15/.project
new file mode 100644
index 0000000000..7fa54e6bac
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Converter_15</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15/src/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_15/src/X.java
new file mode 100644
index 0000000000..fa1d49312e
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15/src/X.java
@@ -0,0 +1,4 @@
+public class X {
+ public void foo(X this) {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.classpath
new file mode 100644
index 0000000000..0d9ce0d3bb
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="var" path="CONVERTER_JCL15_LIB" sourcepath="CONVERTER_JCL15_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.project b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.project
new file mode 100644
index 0000000000..8dad5b66b3
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Converter_15_1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/javadoc/test0001/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/javadoc/test0001/X.java
new file mode 100644
index 0000000000..7e327a4494
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/javadoc/test0001/X.java
@@ -0,0 +1,7 @@
+public class X {
+ /**
+ * @see test1.one.two/
+ */
+ public void foo(X this) {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/module-info.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/module-info.java
new file mode 100644
index 0000000000..fa1d49312e
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_15_1/src/module-info.java
@@ -0,0 +1,4 @@
+public class X {
+ public void foo(X this) {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/.classpath b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/.classpath
index 2205995334..c7623987ab 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/.classpath
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/.classpath
@@ -2,6 +2,12 @@
<classpath>
<classpathentry excluding="b81556/b/" kind="src" path="src"/>
<classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
+ <classpathentry kind="lib" path="lib/record_reference_in_nonsource_jar.jar" sourcepath="/JavaSearchBugs/lib/record_reference_in_nonsource_jar.jar"/>
+ <classpathentry kind="lib" path="lib/record_reference_in_source_jar.jar" sourcepath="/JavaSearchBugs/lib/record_reference_in_source_jar.jar"/>
+ <classpathentry kind="lib" path="lib/permit_reference_in_nonsource_jar.jar" sourcepath="/JavaSearchBugs/lib/permit_reference_in_nonsource_jar.jar"/>
+ <classpathentry kind="lib" path="lib/permit_reference_in_source_jar.jar" sourcepath="/JavaSearchBugs/lib/permit_reference_in_source_jar.jar"/>
+ <classpathentry kind="lib" path="lib/annotation_in_record_jar.jar" sourcepath="/JavaSearchBugs/lib/annotation_in_record_jar.jar"/>
+ <classpathentry kind="lib" path="lib/annotation_in_record_source_jar.jar" sourcepath="/JavaSearchBugs/lib/annotation_in_record_source_jar.jar"/>
<classpathentry kind="lib" path="lib/test81556.jar" sourcepath="/JavaSearchBugs/lib/test81556.jar"/>
<classpathentry kind="lib" path="lib/test75816.jar" sourcepath="/JavaSearchBugs/lib/test75816.jar"/>
<classpathentry kind="lib" path="lib/b86293.jar"/>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_jar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_jar.jar
new file mode 100644
index 0000000000..e4560c3aed
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_jar.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_source_jar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_source_jar.jar
new file mode 100644
index 0000000000..10949544c7
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/annotation_in_record_source_jar.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_nonsource_jar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_nonsource_jar.jar
new file mode 100644
index 0000000000..11c518238f
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_nonsource_jar.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_source_jar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_source_jar.jar
new file mode 100644
index 0000000000..32f9b4707d
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/permit_reference_in_source_jar.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_nonsource_jar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_nonsource_jar.jar
new file mode 100644
index 0000000000..95605868db
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_nonsource_jar.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_source_jar.jar b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_source_jar.jar
new file mode 100644
index 0000000000..2d696d4f07
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearchBugs/lib/record_reference_in_source_jar.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/workspace/test_automodules/bin/test_automodules/Test.class b/org.eclipse.jdt.core.tests.model/workspace/test_automodules/bin/test_automodules/Test.class
new file mode 100644
index 0000000000..a41a6f80b9
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/test_automodules/bin/test_automodules/Test.class
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/SecondaryTypesPerformanceTest.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/SecondaryTypesPerformanceTest.java
index 48d06f7016..e943f2565a 100644
--- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/SecondaryTypesPerformanceTest.java
+++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/SecondaryTypesPerformanceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2019 Sven Strohschein and others.
+ * Copyright (c) 2016, 2020 Sven Strohschein and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -84,7 +84,7 @@ public class SecondaryTypesPerformanceTest extends PerformanceTestCase {
classpathList.add(testScratchArea);
for (int i = 0; i<10; ++i) {
- ASTParser parser = ASTParser.newParser(AST.JLS14);
+ ASTParser parser = ASTParser.newParser(AST.JLS15);
parser.setResolveBindings(true);
parser.setStatementsRecovery(true);
parser.setBindingsRecovery(true);
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
index df3c560d03..0d8904b8a8 100644
--- a/org.eclipse.jdt.core/.settings/.api_filters
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jdt.core" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter id="924844039">
+ <message_arguments>
+ <message_argument value="3.23.100"/>
+ <message_argument value="3.23.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java" type="org.eclipse.jdt.core.compiler.CategorizedProblem">
<filter comment="Java 14" id="576725006">
<message_arguments>
@@ -9,137 +17,30 @@
</filter>
</resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/IProblem.java" type="org.eclipse.jdt.core.compiler.IProblem">
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionaYieldSwitchLabeledBlockCompletesNormally"/>
- <message_argument value="2098855"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldBreakNotAllowed"/>
- <message_argument value="2098863"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
+ <filter id="388194388">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldEmptySwitchBlock"/>
- <message_argument value="2098853"/>
+ <message_argument value="PatternVariableNotInScope"/>
+ <message_argument value="2098912"/>
</message_arguments>
</filter>
- <filter comment="Needed for Java14" id="388194388">
+ <filter id="388194388">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldIllegalLastStatement"/>
- <message_argument value="2098862"/>
+ <message_argument value="RecordMissingExplicitConstructorCallInNonCanonicalConstructor"/>
+ <message_argument value="2098909"/>
</message_arguments>
</filter>
- <filter comment="Needed for Java14" id="388194388">
+ <filter comment="Record preview 2 changes" id="405864542">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldIllegalStatement"/>
- <message_argument value="2098868"/>
+ <message_argument value="RecordCanonicalConstructorShouldBePublic"/>
</message_arguments>
</filter>
- <filter comment="Needed for Java14" id="388194388">
+ <filter id="405864542">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldIncompatibleResultExpressionTypes"/>
- <message_argument value="2098852"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldLastStatementCompletesNormally"/>
- <message_argument value="2098856"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldMissingDefaultCase"/>
- <message_argument value="2098859"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldMissingEnumConstantCase"/>
- <message_argument value="2098861"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldMissingValue"/>
- <message_argument value="2098860"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldNoResultExpression"/>
- <message_argument value="2098854"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldOutsideSwitchExpression"/>
- <message_argument value="2098866"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldRestrictedGeneralWarning"/>
- <message_argument value="2098867"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldTrailingSwitchLabels"/>
- <message_argument value="2098857"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldTypeDeclarationError"/>
- <message_argument value="2098870"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldTypeDeclarationWarning"/>
- <message_argument value="2098869"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldUnqualifiedMethodError"/>
- <message_argument value="2098865"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchExpressionsYieldUnqualifiedMethodWarning"/>
- <message_argument value="2098864"/>
- </message_arguments>
- </filter>
- <filter comment="Needed for Java14" id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="SwitchPreviewMixedCase"/>
- <message_argument value="2098858"/>
+ <message_argument value="RecordIsAReservedTypeName"/>
</message_arguments>
</filter>
</resource>
@@ -207,14 +108,6 @@
</message_arguments>
</filter>
</resource>
- <resource path="dom/org/eclipse/jdt/core/dom/InstanceofExpression.java" type="org.eclipse.jdt.core.dom.InstanceofExpression">
- <filter comment="For Java 14" id="336658481">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.dom.InstanceofExpression"/>
- <message_argument value="PATTERN_VARIABLE_PROPERTY"/>
- </message_arguments>
- </filter>
- </resource>
<resource path="dom/org/eclipse/jdt/core/dom/MemberRef.java" type="org.eclipse.jdt.core.dom.MemberRef">
<filter id="576725006">
<message_arguments>
@@ -237,14 +130,6 @@
</message_arguments>
</filter>
</resource>
- <resource path="dom/org/eclipse/jdt/core/dom/MethodDeclaration.java" type="org.eclipse.jdt.core.dom.MethodDeclaration">
- <filter comment="Needed for Java 14" id="336658481">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.dom.MethodDeclaration"/>
- <message_argument value="COMPACT_CONSTRUCTOR_PROPERTY"/>
- </message_arguments>
- </filter>
- </resource>
<resource path="dom/org/eclipse/jdt/core/dom/MethodRef.java" type="org.eclipse.jdt.core.dom.MethodRef">
<filter id="576725006">
<message_arguments>
@@ -275,6 +160,28 @@
</message_arguments>
</filter>
</resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/Modifier.java" type="org.eclipse.jdt.core.dom.Modifier$ModifierKeyword">
+ <filter comment="For Java 15" id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.Modifier.ModifierKeyword"/>
+ <message_argument value="NON_SEALED_KEYWORD"/>
+ </message_arguments>
+ </filter>
+ <filter comment="For Java 15" id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.Modifier.ModifierKeyword"/>
+ <message_argument value="SEALED_KEYWORD"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java" type="org.eclipse.jdt.core.dom.ModuleQualifiedName">
+ <filter id="576778288">
+ <message_arguments>
+ <message_argument value="Name"/>
+ <message_argument value="ModuleQualifiedName"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="dom/org/eclipse/jdt/core/dom/Name.java" type="org.eclipse.jdt.core.dom.Name">
<filter id="576725006">
<message_arguments>
@@ -347,6 +254,14 @@
</message_arguments>
</filter>
</resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/TypeDeclaration.java" type="org.eclipse.jdt.core.dom.TypeDeclaration">
+ <filter comment="Added For Java 15" id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.TypeDeclaration"/>
+ <message_argument value="PERMITS_TYPES_PROPERTY"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="dom/org/eclipse/jdt/core/dom/TypeParameter.java" type="org.eclipse.jdt.core.dom.TypeParameter">
<filter id="576778288">
<message_arguments>
@@ -388,10 +303,10 @@
</filter>
</resource>
<resource path="model/org/eclipse/jdt/core/util/IClassFileReader.java" type="org.eclipse.jdt.core.util.IClassFileReader">
- <filter comment="For the Java 14 preview feature record" id="404000815">
+ <filter comment="Permitted Subclasses for JEP 360 Sealed Types" id="404000815">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.util.IClassFileReader"/>
- <message_argument value="getRecordAttribute()"/>
+ <message_argument value="getPermittedSubclassesAttribute()"/>
</message_arguments>
</filter>
</resource>
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index 32cbf3c8b9..a9d73c5e62 100644
--- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Main-Class: org.eclipse.jdt.internal.compiler.batch.Main
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.23.0.qualifier
+Bundle-Version: 3.23.100.qualifier
Bundle-Activator: org.eclipse.jdt.core.JavaCore
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index 86b5a67575..4585512872 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -2112,6 +2112,16 @@ public void configure(String[] argv) {
continue;
}
}
+ if (currentArg.equals("-15") || currentArg.equals("-15.0")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (didSpecifyCompliance) {
+ throw new IllegalArgumentException(
+ this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
+ }
+ didSpecifyCompliance = true;
+ this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ mode = DEFAULT;
+ continue;
+ }
if (currentArg.equals("-d")) { //$NON-NLS-1$
if (this.destinationPath != null) {
StringBuffer errorMessage = new StringBuffer();
@@ -3156,6 +3166,9 @@ private String optionStringToVersion(String currentArg) {
case "14":
case "14.0":
return CompilerOptions.VERSION_14;
+ case "15":
+ case "15.0":
+ return CompilerOptions.VERSION_15;
default:
return null;
}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
index 2bbe2e5ec0..588f9767fe 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 71ae33727e..ac77150e33 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -67,7 +67,7 @@ configure.duplicateTarget = duplicate target compliance setting specification: {
configure.unsupportedReleaseOption = option --release is supported only when run with JDK 9 or above
configure.unsupportedWithRelease = option {0} is not supported when --release is used
configure.unsupportedReleaseVersion = release version {0} is not supported
-configure.source = source level should be in ''1.1''...''1.8'',''9''...''14'' (or ''5.0''..''14.0''): {0}
+configure.source = source level should be in ''1.1''...''1.8'',''9''...''15'' (or ''5.0''..''15.0''): {0}
configure.invalidSystem = invalid location for system libraries: {0}
configure.unsupportedOption = option {0} not supported at compliance level 9 and above
configure.duplicateOutputPath = duplicate output path specification: {0}
@@ -84,7 +84,7 @@ configure.invalidDebugOption = invalid debug option: {0}
configure.invalidWarningConfiguration = invalid warning configuration: ''{0}''
configure.invalidWarning = invalid warning token: ''{0}''. Ignoring warning and compiling
configure.invalidWarningOption = invalid warning option: ''{0}''. Must specify a warning token
-configure.targetJDK = target level should be in ''1.1''...''1.8'',''9''...''14'' (or ''5.0''..''14.0'') or cldc1.1: {0}
+configure.targetJDK = target level should be in ''1.1''...''1.8'',''9''...''15'' (or ''5.0''..''15.0'') or cldc1.1: {0}
configure.incompatibleTargetForSource = Target level ''{0}'' is incompatible with source level ''{1}''. A target level ''{1}'' or better is required
configure.incompatibleTargetForGenericSource = Target level ''{0}'' is incompatible with source level ''{1}''. A source level ''1.5'' or better is required
configure.incompatibleComplianceForSource = Compliance level ''{0}'' is incompatible with source level ''{1}''. A compliance level ''{1}'' or better is required
@@ -250,9 +250,10 @@ misc.usage = {1} {2}\n\
\ -12 -12.0 use 12 compliance (-source 12 -target 12)\n\
\ -13 -13.0 use 13 compliance (-source 13 -target 13)\n\
\ -14 -14.0 use 14 compliance (-source 14 -target 14)\n\
-\ -source <version> set source level: 1.3 to 1.9, 10 to 14\n\
+\ -15 -15.0 use 15 compliance (-source 15 -target 15)\n\
+\ -source <version> set source level: 1.3 to 1.9, 10 to 15\n\
\ (or 6, 6.0, etc)\n\
-\ -target <version> set classfile target: 1.3 to 1.9, 10 to 14\n\
+\ -target <version> set classfile target: 1.3 to 1.9, 10 to 15\n\
\ (or 6, 6.0, etc)\n\
\ cldc1.1 can also be used to generate the StackMap\n\
\ attribute\n\
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java
index 13f9cdccce..0db23c7f4f 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java
@@ -41,7 +41,6 @@ import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.RecordComponent;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.parser.Parser;
import org.eclipse.jdt.internal.core.AnnotatableInfo;
@@ -94,7 +93,7 @@ public class CompletionUnitStructureRequestor extends CompilationUnitStructureRe
protected SourceField createField(JavaElement parent, FieldInfo fieldInfo) {
String fieldName = JavaModelManager.getJavaModelManager().intern(new String(fieldInfo.name));
AssistSourceField field = new AssistSourceField(parent, fieldName, this.bindingCache, this.newElements);
- FieldDeclaration decl = (fieldInfo.node);
+ FieldDeclaration decl = (FieldDeclaration) (fieldInfo.node);
if (decl.binding != null) {
this.bindingCache.put(field, decl.binding);
this.elementCache.put(decl.binding, field);
@@ -104,7 +103,7 @@ public class CompletionUnitStructureRequestor extends CompilationUnitStructureRe
return field;
}
@Override
- protected SourceField createRecordComponent(JavaElement parent, RecordComponentInfo compInfo) {
+ protected SourceField createRecordComponent(JavaElement parent, FieldInfo compInfo) {
String compName = JavaModelManager.getJavaModelManager().intern(new String(compInfo.name));
SourceField comp = new AssistSourceField(parent, compName, this.bindingCache, this.newElements) {
@Override
@@ -112,7 +111,7 @@ public class CompletionUnitStructureRequestor extends CompilationUnitStructureRe
return true;
}
};
- RecordComponent decl = (compInfo.node);
+ FieldDeclaration decl = (FieldDeclaration) (compInfo.node);
if (decl.binding != null) {
this.bindingCache.put(compName, decl.binding);
this.elementCache.put(decl.binding, compName);
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
index f2c1f77d8d..2c4be9a7fc 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -550,8 +550,13 @@ public class CompletionJavadocParser extends JavadocParser {
@Override
protected boolean parseReference() throws InvalidInputException {
+ return parseReference(false);
+ }
+
+ @Override
+ protected boolean parseReference(boolean allowModule) throws InvalidInputException {
boolean completed = this.completionNode != null;
- boolean valid = super.parseReference();
+ boolean valid = super.parseReference(allowModule);
if (!completed && this.completionNode != null) {
this.completionNode.addCompletionFlags(CompletionOnJavadoc.FORMAL_REFERENCE);
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index 68aea7e2c3..ca4d6b58f7 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -31,16 +31,100 @@ package org.eclipse.jdt.internal.codeassist.complete;
import java.util.HashSet;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.internal.compiler.*;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.codeassist.impl.AssistParser;
+import org.eclipse.jdt.internal.codeassist.impl.Keywords;
+import org.eclipse.jdt.internal.codeassist.impl.RestrictedIdentifiers;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
+import org.eclipse.jdt.internal.compiler.ast.ArrayReference;
+import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
+import org.eclipse.jdt.internal.compiler.ast.Assignment;
+import org.eclipse.jdt.internal.compiler.ast.BinaryExpression;
+import org.eclipse.jdt.internal.compiler.ast.Block;
+import org.eclipse.jdt.internal.compiler.ast.CaseStatement;
+import org.eclipse.jdt.internal.compiler.ast.CastExpression;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment;
+import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
+import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.EmptyStatement;
+import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
+import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
+import org.eclipse.jdt.internal.compiler.ast.Expression;
+import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.ForStatement;
+import org.eclipse.jdt.internal.compiler.ast.IfStatement;
+import org.eclipse.jdt.internal.compiler.ast.ImportReference;
+import org.eclipse.jdt.internal.compiler.ast.Initializer;
+import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression;
+import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
+import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
+import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
+import org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.ModuleDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.ModuleReference;
+import org.eclipse.jdt.internal.compiler.ast.NameReference;
+import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
+import org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.PrefixExpression;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
+import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression;
+import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
+import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
+import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.Statement;
+import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
+import org.eclipse.jdt.internal.compiler.ast.SuperReference;
+import org.eclipse.jdt.internal.compiler.ast.SwitchExpression;
+import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
+import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement;
+import org.eclipse.jdt.internal.compiler.ast.ThisReference;
+import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
+import org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
+import org.eclipse.jdt.internal.compiler.ast.TryStatement;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.ast.UnaryExpression;
+import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.WhileStatement;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
-import org.eclipse.jdt.internal.compiler.env.*;
-import org.eclipse.jdt.internal.compiler.ast.*;
-import org.eclipse.jdt.internal.compiler.parser.*;
-import org.eclipse.jdt.internal.compiler.problem.*;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
+import org.eclipse.jdt.internal.compiler.parser.JavadocParser;
+import org.eclipse.jdt.internal.compiler.parser.Parser;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredAnnotation;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredBlock;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredElement;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredField;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredInitializer;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredLocalVariable;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredMethod;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredModule;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredPackageVisibilityStatement;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredProvidesStatement;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredType;
+import org.eclipse.jdt.internal.compiler.parser.RecoveredUnit;
+import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt;
import org.eclipse.jdt.internal.compiler.util.Util;
-import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.codeassist.impl.*;
public class CompletionParser extends AssistParser {
// OWNER
@@ -1567,12 +1651,21 @@ private boolean checkKeywordAndRestrictedIdentifiers() {
if((this.lastModifiers & ClassFileConstants.AccFinal) == 0) {
keywordsAndRestrictedIndentifiers[count++] = Keywords.INTERFACE;
}
- if (this.options.complianceLevel >= ClassFileConstants.JDK14 && this.options.enablePreviewFeatures == true) {
+ if (this.options.complianceLevel >= ClassFileConstants.JDK14
+ && this.options.enablePreviewFeatures == true) {
keywordsAndRestrictedIndentifiers[count++] = RestrictedIdentifiers.RECORD;
}
-
+ if (this.options.complianceLevel >= ClassFileConstants.JDK15
+ && this.options.enablePreviewFeatures == true) {
+ boolean nonSeal = (this.lastModifiers & ExtraCompilerModifiers.AccNonSealed) != 0;
+ boolean seal = (this.lastModifiers & ExtraCompilerModifiers.AccSealed) != 0;
+ if (!nonSeal && !seal) {
+ keywordsAndRestrictedIndentifiers[count++] = RestrictedIdentifiers.SEALED;
+ keywordsAndRestrictedIndentifiers[count++] = RestrictedIdentifiers.NON_SEALED;
+ }
+ }
}
- if(count != 0) {
+ if (count != 0) {
System.arraycopy(keywordsAndRestrictedIndentifiers, 0, keywordsAndRestrictedIndentifiers = new char[count][], 0, count);
this.assistNode = new CompletionOnKeyword2(ident, pos, keywordsAndRestrictedIndentifiers);
@@ -2146,6 +2239,11 @@ private void classHeaderExtendsOrImplements(boolean isInterface, boolean isRecor
}
keywords[count++] = Keywords.IMPLEMENTS;
}
+ if (this.options.enablePreviewFeatures) {
+ boolean sealed = (type.modifiers & ExtraCompilerModifiers.AccSealed) != 0;
+ if (sealed)
+ keywords[count++] = RestrictedIdentifiers.PERMITS;
+ }
System.arraycopy(keywords, 0, keywords = new char[count][], 0, count);
@@ -2476,15 +2574,27 @@ protected void consumeClassHeaderExtends() {
RecoveredType recoveredType = (RecoveredType)this.currentElement;
/* filter out cases where scanner is still inside type header */
if (!recoveredType.foundOpeningBrace) {
+ char[][] keywords = new char[2][];
+ int count = 0;
TypeDeclaration type = recoveredType.typeDeclaration;
if(type.superInterfaces == null) {
- type.superclass = new CompletionOnKeyword1(
+ keywords[count++] = Keywords.IMPLEMENTS;
+ }
+ if (this.options.enablePreviewFeatures) {
+ boolean sealed = (type.modifiers & ExtraCompilerModifiers.AccSealed) != 0;
+ if (sealed)
+ keywords[count++] = RestrictedIdentifiers.PERMITS;
+ }
+ System.arraycopy(keywords, 0, keywords = new char[count][], 0, count);
+ if(count > 0) {
+ CompletionOnKeyword1 completionOnKeyword = new CompletionOnKeyword1(
this.identifierStack[ptr],
this.identifierPositionStack[ptr],
- Keywords.IMPLEMENTS);
+ keywords);
+ type.superclass = completionOnKeyword;
type.superclass.bits |= ASTNode.IsSuperType;
- this.assistNode = type.superclass;
- this.lastCheckPoint = type.superclass.sourceEnd + 1;
+ this.assistNode = completionOnKeyword;
+ this.lastCheckPoint = completionOnKeyword.sourceEnd + 1;
}
}
}
@@ -2518,7 +2628,6 @@ protected void consumeClassTypeElt() {
super.consumeClassTypeElt();
popElement(K_NEXT_TYPEREF_IS_EXCEPTION);
}
-
@Override
protected void consumeCompilationUnit() {
this.javadoc = null;
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/RestrictedIdentifiers.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/RestrictedIdentifiers.java
index 6914830940..f9cdde1c3d 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/RestrictedIdentifiers.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/RestrictedIdentifiers.java
@@ -14,8 +14,11 @@
package org.eclipse.jdt.internal.codeassist.impl;
public interface RestrictedIdentifiers {
- int COUNT = 1;
+ int COUNT = 4;
- char[] RECORD = "record".toCharArray();//$NON-NLS-1$
+ char[] RECORD = "record".toCharArray();//$NON-NLS-1$
+ char[] SEALED = "sealed".toCharArray();//$NON-NLS-1$
+ char[] NON_SEALED = "non-sealed".toCharArray();//$NON-NLS-1$
+ char[] PERMITS = "permits".toCharArray();//$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
index e5440af744..c9ff4d220a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
@@ -780,8 +780,7 @@ void setSourceStart(int sourceStart);
/** @since 3.10 */
int MissingTypeInLambda = MethodRelated + 271;
- /** @since 3.20
- * @noreference preview related error */
+ /** @since 3.23 */
int UnterminatedTextBlock = PreviewRelated + 272;
// type related problems
/** @since 3.1 */
@@ -1222,6 +1221,8 @@ void setSourceStart(int sourceStart);
int JavadocInvalidProvidesClassName = Javadoc + Internal + 1808;
/** @since 3.20 */
int JavadocInvalidProvidesClass = Javadoc + Internal + 1809;
+ /** @since 3.23 */
+ int JavadocInvalidModuleQualification = Javadoc + Internal + 1810;
/**
* Generics
@@ -2118,6 +2119,8 @@ void setSourceStart(int sourceStart);
int PreviewFeatureNotSupported = Compliance + 1105;
/** @since 3.20*/
int PreviewFeaturesNotAllowed = PreviewRelated + 1106;
+ /** @since 3.23 */
+ int FeatureNotSupported = Compliance + 1107;
/** @since 3.13 */
int UnlikelyCollectionMethodArgumentType = 1200;
@@ -2247,6 +2250,9 @@ void setSourceStart(int sourceStart);
int SwitchExpressionsContinueOutOfSwitchExpression = Syntax + 1723;
/** @since 3.22 */
int SwitchExpressionsReturnWithinSwitchExpression = Syntax + 1724;
+
+ /* Java 14 errors end */
+ /* Java 15 errors begin */
/* records - begin */
/** @since 3.22
@@ -2269,9 +2275,9 @@ void setSourceStart(int sourceStart);
/** @since 3.22
* @noreference preview feature error */
int RecordCanonicalConstructorHasThrowsClause = PreviewRelated + 1735;
- /** @since 3.22
+ /** @since 3.23
* @noreference preview feature error */
- int RecordCanonicalConstructorShouldBePublic = PreviewRelated + 1736;
+ int RecordCanonicalConstructorVisibilityReduced = PreviewRelated + 1736;
/** @since 3.22
* @noreference preview feature error */
int RecordMultipleCanonicalConstructors = PreviewRelated + 1737;
@@ -2287,9 +2293,9 @@ void setSourceStart(int sourceStart);
/** @since 3.22
* @noreference preview feature error */
int RecordInstanceInitializerBlockInRecord = PreviewRelated + 1741;
- /** @since 3.22
+ /** @since 3.23
* @noreference preview feature error */
- int RecordIsAReservedTypeName = PreviewRelated + 1742;
+ int RestrictedTypeName = PreviewRelated + 1742;
/** @since 3.22
* @noreference preview feature error */
int RecordIllegalAccessorReturnType = PreviewRelated + 1743;
@@ -2334,11 +2340,80 @@ void setSourceStart(int sourceStart);
int RecordCannotDefineRecordInLocalType= PreviewRelated + 1756;
/** @since 3.23
* @noreference preview feature error */
- int RecordMissingExplicitConstructorCallInNonCanonicalConstructor= PreviewRelated + 1757;
+ int RecordComponentsCannotHaveModifiers= PreviewRelated + 1757;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int RecordIllegalParameterNameInCanonicalConstructor = PreviewRelated + 1758;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int RecordIllegalExplicitFinalFieldAssignInCompactConstructor = PreviewRelated + 1759;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int RecordMissingExplicitConstructorCallInNonCanonicalConstructor= PreviewRelated + 1760;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int RecordIllegalStaticModifierForLocalClassOrInterface = PreviewRelated + 1761;
+
+ /** @since 3.23
+ * @noreference preview feature error */
+ int LocalStaticsIllegalVisibilityModifierForInterfaceLocalType = PreviewRelated + 1765;
/* records - end */
+
+
/* instanceof pattern: */
/** @since 3.22
+ * @deprecated problem no longer generated */
+ int PatternVariableNotInScope = PreviewRelated + 1780;
+
+
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedMissingClassModifier = PreviewRelated + 1850;
+ /** @since 3.23
* @noreference preview feature error */
- int PatternVariableNotInScope = PreviewRelated + 1760;
- /* Java14 errors - end */
+ int SealedDisAllowedNonSealedModifierInClass = PreviewRelated + 1851;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedSuperClassDoesNotPermit = PreviewRelated + 1852;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedSuperInterfaceDoesNotPermit = PreviewRelated + 1853;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedMissingSealedModifier = PreviewRelated + 1854;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedMissingInterfaceModifier = PreviewRelated + 1855;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedDuplicateTypeInPermits = PreviewRelated + 1856;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedNotDirectSuperClass = PreviewRelated + 1857;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedPermittedTypeOutsideOfModule = PreviewRelated + 1858;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedPermittedTypeOutsideOfPackage = PreviewRelated + 1859;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedSealedTypeMissingPermits = PreviewRelated + 1860;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedInterfaceIsSealedAndNonSealed = PreviewRelated + 1861;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedDisAllowedNonSealedModifierInInterface = PreviewRelated + 1862;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedNotDirectSuperInterface = PreviewRelated + 1863;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedLocalDirectSuperTypeSealed = PreviewRelated + 1864;
+ /** @since 3.23
+ * @noreference preview feature error */
+ int SealedAnonymousClassCannotExtendSealedType = PreviewRelated + 1865;
+ /* Java15 errors - end */
+
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
index abc6f8a15a..00e93e6c95 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -244,6 +244,12 @@ public abstract class ASTVisitor {
public void endVisit(JavadocQualifiedTypeReference typeRef, ClassScope scope) {
// do nothing by default
}
+ public void endVisit(JavadocModuleReference moduleRef, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocModuleReference moduleRef, ClassScope scope) {
+ // do nothing by default
+ }
public void endVisit(JavadocReturnStatement statement, BlockScope scope) {
// do nothing by default
}
@@ -740,6 +746,12 @@ public abstract class ASTVisitor {
public boolean visit(JavadocQualifiedTypeReference typeRef, ClassScope scope) {
return true; // do nothing by default, keep traversing
}
+ public boolean visit(JavadocModuleReference moduleRef, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocModuleReference moduleRef, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
public boolean visit(JavadocReturnStatement statement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
index 73582801a2..d097483e07 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -42,6 +42,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.compiler.IProblem;
@@ -139,7 +142,6 @@ import org.eclipse.jdt.internal.compiler.util.Util;
* information. Those bytes are decodable with a regular class file reader,
* such as DietClassFileReader
*/
-@SuppressWarnings({"rawtypes", "unchecked"})
public class ClassFile implements TypeConstants, TypeIds {
private byte[] bytes;
@@ -174,7 +176,7 @@ public class ClassFile implements TypeConstants, TypeIds {
public List<TypeBinding> missingTypes = null;
- public Set visitedTypes;
+ public Set<TypeBinding> visitedTypes;
public static final int INITIAL_CONTENTS_SIZE = 400;
public static final int INITIAL_HEADER_SIZE = 1500;
@@ -431,16 +433,18 @@ public class ClassFile implements TypeConstants, TypeIds {
if (this.bootstrapMethods != null && !this.bootstrapMethods.isEmpty()) {
attributesNumber += generateBootstrapMethods(this.bootstrapMethods);
}
+ if (this.targetJDK >= ClassFileConstants.JDK15) {
+ // add record attributes
+ attributesNumber += generatePermittedTypeAttributes();
+ }
// Inner class attribute
int numberOfInnerClasses = this.innerClassesBindings == null ? 0 : this.innerClassesBindings.size();
if (numberOfInnerClasses != 0) {
ReferenceBinding[] innerClasses = new ReferenceBinding[numberOfInnerClasses];
this.innerClassesBindings.keySet().toArray(innerClasses);
- Arrays.sort(innerClasses, new Comparator() {
+ Arrays.sort(innerClasses, new Comparator<ReferenceBinding>() {
@Override
- public int compare(Object o1, Object o2) {
- TypeBinding binding1 = (TypeBinding) o1;
- TypeBinding binding2 = (TypeBinding) o2;
+ public int compare(ReferenceBinding o1, ReferenceBinding o2) {
Boolean onBottom1 = ClassFile.this.innerClassesBindings.get(o1);
Boolean onBottom2 = ClassFile.this.innerClassesBindings.get(o2);
if (onBottom1) {
@@ -452,7 +456,7 @@ public class ClassFile implements TypeConstants, TypeIds {
return -1;
}
}
- return CharOperation.compareTo(binding1.constantPoolName(), binding2.constantPoolName());
+ return CharOperation.compareTo(o1.constantPoolName(), o2.constantPoolName());
}
});
attributesNumber += generateInnerClassAttribute(numberOfInnerClasses, innerClasses);
@@ -579,7 +583,9 @@ public class ClassFile implements TypeConstants, TypeIds {
try {
if (fieldDeclaration.isARecordComponent) {
long rcMask = TagBits.AnnotationForField | TagBits.AnnotationForTypeUse;
- fieldDeclaration.annotations = getAnnotationsFromAssociatedRecordComponent(fieldBinding.declaringClass, fieldBinding.name, rcMask);
+ RecordComponent comp = getRecordComponent(fieldBinding.declaringClass, fieldBinding.name);
+ if (comp != null)
+ fieldDeclaration.annotations = ASTNode.getRelevantAnnotations(comp.annotations, rcMask, null);
}
Annotation[] annotations = fieldDeclaration.annotations;
if (annotations != null) {
@@ -587,35 +593,19 @@ public class ClassFile implements TypeConstants, TypeIds {
}
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
- List allTypeAnnotationContexts = new ArrayList();
+ List<AnnotationContext> allTypeAnnotationContexts = new ArrayList<>();
if (annotations != null && (fieldDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
fieldDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
}
- int invisibleTypeAnnotationsCounter = 0;
- int visibleTypeAnnotationsCounter = 0;
TypeReference fieldType = fieldDeclaration.type;
if (fieldType != null && ((fieldType.bits & ASTNode.HasTypeAnnotations) != 0)) {
fieldType.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
}
int size = allTypeAnnotationContexts.size();
- if (size != 0) {
- AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
- allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
- for (int i = 0, max = allTypeAnnotationContextsArray.length; i < max; i++) {
- AnnotationContext annotationContext = allTypeAnnotationContextsArray[i];
- if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
- invisibleTypeAnnotationsCounter++;
- allTypeAnnotationContexts.add(annotationContext);
- } else {
- visibleTypeAnnotationsCounter++;
- allTypeAnnotationContexts.add(annotationContext);
- }
- }
- attributesNumber += generateRuntimeTypeAnnotations(
- allTypeAnnotationContextsArray,
- visibleTypeAnnotationsCounter,
- invisibleTypeAnnotationsCounter);
- }
+ attributesNumber = completeRuntimeTypeAnnotations(attributesNumber,
+ null,
+ (node) -> size > 0,
+ () -> allTypeAnnotationContexts);
}
} finally {
if (fieldDeclaration.isARecordComponent) {
@@ -629,15 +619,13 @@ public class ClassFile implements TypeConstants, TypeIds {
}
return attributesNumber;
}
- private Annotation[] getAnnotationsFromAssociatedRecordComponent(ReferenceBinding declaringClass,
- char[] name, long rcMask) {
+ private RecordComponent getRecordComponent(ReferenceBinding declaringClass, char[] name) {
if (declaringClass instanceof SourceTypeBinding) {
SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) declaringClass;
RecordComponentBinding rcb = sourceTypeBinding.getRecordComponent(name);
if (rcb != null) {
RecordComponent recordComponent = rcb.sourceRecordComponent();
- assert recordComponent != null;
- return ASTNode.getRelevantAnnotations(recordComponent.annotations, rcMask, null);
+ return recordComponent;
}
}
return null;
@@ -658,35 +646,20 @@ public class ClassFile implements TypeConstants, TypeIds {
}
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
- List allTypeAnnotationContexts = new ArrayList();
+ List<AnnotationContext> allTypeAnnotationContexts = new ArrayList<>();
if (annotations != null && (recordComponent.bits & ASTNode.HasTypeAnnotations) != 0) {
recordComponent.getAllAnnotationContexts(AnnotationTargetTypeConstants.FIELD, allTypeAnnotationContexts);
}
- int invisibleTypeAnnotationsCounter = 0;
- int visibleTypeAnnotationsCounter = 0;
TypeReference recordComponentType = recordComponent.type;
if (recordComponentType != null && ((recordComponentType.bits & ASTNode.HasTypeAnnotations) != 0)) {
recordComponentType.getAllAnnotationContexts(AnnotationTargetTypeConstants.RECORD_COMPONENT, allTypeAnnotationContexts);
}
int size = allTypeAnnotationContexts.size();
- if (size != 0) {
- AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
- allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
- for (int i = 0, max = allTypeAnnotationContextsArray.length; i < max; i++) {
- AnnotationContext annotationContext = allTypeAnnotationContextsArray[i];
- if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
- invisibleTypeAnnotationsCounter++;
- allTypeAnnotationContexts.add(annotationContext);
- } else {
- visibleTypeAnnotationsCounter++;
- allTypeAnnotationContexts.add(annotationContext);
- }
- }
- attributesNumber += generateRuntimeTypeAnnotations(
- allTypeAnnotationContextsArray,
- visibleTypeAnnotationsCounter,
- invisibleTypeAnnotationsCounter);
- }
+ attributesNumber = completeRuntimeTypeAnnotations(attributesNumber,
+ null,
+ (node) -> size > 0,
+ () -> allTypeAnnotationContexts);
+
}
}
if ((recordComponentBinding.tagBits & TagBits.HasMissingType) != 0) {
@@ -1717,9 +1690,7 @@ public class ClassFile implements TypeConstants, TypeIds {
public int generateTypeAnnotationsOnCodeAttribute() {
int attributesNumber = 0;
- List allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts;
- int invisibleTypeAnnotationsCounter = 0;
- int visibleTypeAnnotationsCounter = 0;
+ List<AnnotationContext> allTypeAnnotationContexts = ((TypeAnnotationCodeStream) this.codeStream).allTypeAnnotationContexts;
for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) {
LocalVariableBinding localVariable = this.codeStream.locals[i];
@@ -1742,24 +1713,11 @@ public class ClassFile implements TypeConstants, TypeIds {
exceptionLabel.exceptionTypeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.EXCEPTION_PARAMETER, i, allTypeAnnotationContexts, exceptionLabel.se7Annotations);
}
}
-
int size = allTypeAnnotationContexts.size();
- if (size != 0) {
- AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
- allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
- for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) {
- AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
- if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
- invisibleTypeAnnotationsCounter++;
- } else {
- visibleTypeAnnotationsCounter++;
- }
- }
- attributesNumber += generateRuntimeTypeAnnotations(
- allTypeAnnotationContextsArray,
- visibleTypeAnnotationsCounter,
- invisibleTypeAnnotationsCounter);
- }
+ attributesNumber = completeRuntimeTypeAnnotations(attributesNumber,
+ null,
+ (node) -> size > 0,
+ () -> allTypeAnnotationContexts);
return attributesNumber;
}
@@ -2399,7 +2357,7 @@ public class ClassFile implements TypeConstants, TypeIds {
((SourceTypeBinding) binding.declaringClass).scope);
}
- private void completeArgumentAnnotationInfo(Argument[] arguments, List allAnnotationContexts) {
+ private void completeArgumentAnnotationInfo(Argument[] arguments, List<AnnotationContext> allAnnotationContexts) {
for (int i = 0, max = arguments.length; i < max; i++) {
Argument argument = arguments[i];
if ((argument.bits & ASTNode.HasTypeAnnotations) != 0) {
@@ -2421,9 +2379,7 @@ public class ClassFile implements TypeConstants, TypeIds {
int attributesNumber) {
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
- List allTypeAnnotationContexts = new ArrayList();
- int invisibleTypeAnnotationsCounter = 0;
- int visibleTypeAnnotationsCounter = 0;
+ List<AnnotationContext> allTypeAnnotationContexts = new ArrayList<>();
AbstractMethodDeclaration methodDeclaration = binding.sourceMethod();
if (methodDeclaration != null) {
if ((methodDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
@@ -2471,22 +2427,10 @@ public class ClassFile implements TypeConstants, TypeIds {
}
}
int size = allTypeAnnotationContexts.size();
- if (size != 0) {
- AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
- allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
- for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) {
- AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
- if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
- invisibleTypeAnnotationsCounter++;
- } else {
- visibleTypeAnnotationsCounter++;
- }
- }
- attributesNumber += generateRuntimeTypeAnnotations(
- allTypeAnnotationContextsArray,
- visibleTypeAnnotationsCounter,
- invisibleTypeAnnotationsCounter);
- }
+ attributesNumber = completeRuntimeTypeAnnotations(attributesNumber,
+ null,
+ (node) -> size > 0,
+ () -> allTypeAnnotationContexts);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_METHOD_PARAMETERS) != 0) {
attributesNumber += generateMethodParameters(binding);
@@ -2919,6 +2863,38 @@ public class ClassFile implements TypeConstants, TypeIds {
nAttrs += generateNestHostAttribute();
return nAttrs;
}
+ private int generatePermittedTypeAttributes() {
+ SourceTypeBinding type = this.referenceBinding;
+ int localContentsOffset = this.contentsOffset;
+ ReferenceBinding[] permittedTypes = type.permittedTypes();
+ int l = permittedTypes != null ? permittedTypes.length : 0;
+ if (l == 0)
+ return 0;
+
+ int exSize = 8 + 2 * l;
+ if (exSize + localContentsOffset >= this.contents.length) {
+ resizeContents(exSize);
+ }
+ int attributeNameIndex =
+ this.constantPool.literalIndex(AttributeNamesConstants.PermittedSubclasses);
+ this.contents[localContentsOffset++] = (byte) (attributeNameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) attributeNameIndex;
+ int value = (l << 1) + 2;
+ this.contents[localContentsOffset++] = (byte) (value >> 24);
+ this.contents[localContentsOffset++] = (byte) (value >> 16);
+ this.contents[localContentsOffset++] = (byte) (value >> 8);
+ this.contents[localContentsOffset++] = (byte) value;
+ this.contents[localContentsOffset++] = (byte) (l >> 8);
+ this.contents[localContentsOffset++] = (byte) l;
+
+ for (int i = 0; i < l; i++) {
+ int permittedTypeIndex = this.constantPool.literalIndexForType(permittedTypes[i]);
+ this.contents[localContentsOffset++] = (byte) (permittedTypeIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) permittedTypeIndex;
+ }
+ this.contentsOffset = localContentsOffset;
+ return 1;
+ }
private int generateRecordAttributes() {
SourceTypeBinding record = this.referenceBinding;
if (record == null || !record.isRecord())
@@ -4134,11 +4110,24 @@ public class ClassFile implements TypeConstants, TypeIds {
assert methodDeclaration == null;
long rcMask = TagBits.AnnotationForMethod | TagBits.AnnotationForTypeUse;
// record component (field) accessor method
- Annotation[] annotations = getAnnotationsFromAssociatedRecordComponent(methodBinding.declaringClass,
- methodBinding.selector, rcMask);
- if (annotations != null) {
- assert !methodBinding.isConstructor();
- attributesNumber += generateRuntimeAnnotations(annotations, rcMask);
+ ReferenceBinding declaringClass = methodBinding.declaringClass;
+ RecordComponent comp = getRecordComponent(declaringClass, methodBinding.selector);
+ if (comp != null) {
+ Annotation[] annotations = ASTNode.getRelevantAnnotations(comp.annotations, rcMask, null);
+ if (annotations != null) {
+ assert !methodBinding.isConstructor();
+ attributesNumber += generateRuntimeAnnotations(annotations, TagBits.AnnotationForMethod);
+ // Now type annotations
+ Supplier<List<AnnotationContext>> collector = () -> {
+ List<AnnotationContext> allTypeAnnotationContexts = new ArrayList<>();
+ comp.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN, allTypeAnnotationContexts);
+ return allTypeAnnotationContexts;
+ };
+ attributesNumber = completeRuntimeTypeAnnotations(attributesNumber,
+ comp,
+ (node) -> (comp.bits & ASTNode.HasTypeAnnotations) != 0,
+ collector);
+ }
}
}
}
@@ -4179,6 +4168,33 @@ public class ClassFile implements TypeConstants, TypeIds {
}
return attributesNumber;
}
+ private int completeRuntimeTypeAnnotations(int attributesNumber,
+ ASTNode node,
+ Predicate<ASTNode> condition,
+ Supplier<List<AnnotationContext>> supplier) {
+ int invisibleTypeAnnotationsCounter = 0;
+ int visibleTypeAnnotationsCounter = 0;
+ if (condition.test(node)) {
+ List<AnnotationContext> allTypeAnnotationContexts = supplier.get();
+ if (allTypeAnnotationContexts.size() > 0) {
+ AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[allTypeAnnotationContexts.size()];
+ allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
+ for (int j = 0, max2 = allTypeAnnotationContextsArray.length; j < max2; j++) {
+ AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
+ if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
+ invisibleTypeAnnotationsCounter++;
+ } else {
+ visibleTypeAnnotationsCounter++;
+ }
+ }
+ attributesNumber += generateRuntimeTypeAnnotations(
+ allTypeAnnotationContextsArray,
+ visibleTypeAnnotationsCounter,
+ invisibleTypeAnnotationsCounter);
+ }
+ }
+ return attributesNumber;
+ }
private void propagateRecordComponentArguments(AbstractMethodDeclaration methodDeclaration) {
if ((methodDeclaration.bits & (ASTNode.IsCanonicalConstructor | ASTNode.IsImplicit)) == 0)
return;
@@ -4354,12 +4370,10 @@ public class ClassFile implements TypeConstants, TypeIds {
int[] missingTypesIndexes = new int[initialSize];
int numberOfMissingTypes = 0;
if (initialSize > 1) {
- Collections.sort(this.missingTypes, new Comparator() {
+ Collections.sort(this.missingTypes, new Comparator<TypeBinding>() {
@Override
- public int compare(Object o1, Object o2) {
- TypeBinding typeBinding1 = (TypeBinding) o1;
- TypeBinding typeBinding2 = (TypeBinding) o2;
- return CharOperation.compareTo(typeBinding1.constantPoolName(), typeBinding2.constantPoolName());
+ public int compare(TypeBinding o1, TypeBinding o2) {
+ return CharOperation.compareTo(o1.constantPoolName(), o2.constantPoolName());
}
});
}
@@ -4963,8 +4977,8 @@ public class ClassFile implements TypeConstants, TypeIds {
StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream;
stackMapFrameCodeStream.removeFramePosition(code_length);
if (stackMapFrameCodeStream.hasFramePositions()) {
- Map frames = new HashMap();
- List realFrames = traverse(isClinit ? null : methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit, scope);
+ Map<Integer, StackMapFrame> frames = new HashMap<>();
+ List<StackMapFrame> realFrames = traverse(isClinit ? null : methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit, scope);
int numberOfFrames = realFrames.size();
if (numberOfFrames > 1) {
int stackMapTableAttributeOffset = localContentsOffset;
@@ -4988,10 +5002,10 @@ public class ClassFile implements TypeConstants, TypeIds {
if (localContentsOffset + 2 >= this.contents.length) {
resizeContents(2);
}
- StackMapFrame currentFrame = (StackMapFrame) realFrames.get(0);
+ StackMapFrame currentFrame = realFrames.get(0);
for (int j = 1; j < numberOfFrames; j++) {
// select next frame
- currentFrame = (StackMapFrame) realFrames.get(j);
+ currentFrame = realFrames.get(j);
// generate current frame
// need to find differences between the current frame and the previous frame
int frameOffset = currentFrame.pc;
@@ -5141,8 +5155,8 @@ public class ClassFile implements TypeConstants, TypeIds {
StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream;
stackMapFrameCodeStream.removeFramePosition(code_length);
if (stackMapFrameCodeStream.hasFramePositions()) {
- Map frames = new HashMap();
- List realFrames = traverse(isClinit ? null: methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit, scope);
+ Map<Integer, StackMapFrame> frames = new HashMap<>();
+ List<StackMapFrame> realFrames = traverse(isClinit ? null: methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit, scope);
int numberOfFrames = realFrames.size();
if (numberOfFrames > 1) {
int stackMapTableAttributeOffset = localContentsOffset;
@@ -5166,12 +5180,12 @@ public class ClassFile implements TypeConstants, TypeIds {
if (localContentsOffset + 2 >= this.contents.length) {
resizeContents(2);
}
- StackMapFrame currentFrame = (StackMapFrame) realFrames.get(0);
+ StackMapFrame currentFrame = realFrames.get(0);
StackMapFrame prevFrame = null;
for (int j = 1; j < numberOfFrames; j++) {
// select next frame
prevFrame = currentFrame;
- currentFrame = (StackMapFrame) realFrames.get(j);
+ currentFrame = realFrames.get(j);
// generate current frame
// need to find differences between the current frame and the previous frame
int offsetDelta = currentFrame.getOffsetDelta(prevFrame);
@@ -5532,10 +5546,8 @@ public class ClassFile implements TypeConstants, TypeIds {
return 0;
}
int attributesNumber = 0;
- int visibleTypeAnnotationsCounter = 0;
- int invisibleTypeAnnotationsCounter = 0;
TypeReference superclass = typeDeclaration.superclass;
- List allTypeAnnotationContexts = new ArrayList();
+ List<AnnotationContext> allTypeAnnotationContexts = new ArrayList<>();
if (superclass != null && (superclass.bits & ASTNode.HasTypeAnnotations) != 0) {
superclass.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS, -1, allTypeAnnotationContexts);
}
@@ -5549,6 +5561,7 @@ public class ClassFile implements TypeConstants, TypeIds {
superInterface.getAllAnnotationContexts(AnnotationTargetTypeConstants.CLASS_EXTENDS, i, allTypeAnnotationContexts);
}
}
+ // TODO: permittedTypes codegen
TypeParameter[] typeParameters = typeDeclaration.typeParameters;
if (typeParameters != null) {
for (int i = 0, max = typeParameters.length; i < max; i++) {
@@ -5559,24 +5572,10 @@ public class ClassFile implements TypeConstants, TypeIds {
}
}
int size = allTypeAnnotationContexts.size();
- if (size != 0) {
- AnnotationContext[] allTypeAnnotationContextsArray = new AnnotationContext[size];
- allTypeAnnotationContexts.toArray(allTypeAnnotationContextsArray);
- for (int j = 0, max = allTypeAnnotationContextsArray.length; j < max; j++) {
- AnnotationContext annotationContext = allTypeAnnotationContextsArray[j];
- if ((annotationContext.visibility & AnnotationContext.INVISIBLE) != 0) {
- invisibleTypeAnnotationsCounter++;
- allTypeAnnotationContexts.add(annotationContext);
- } else {
- visibleTypeAnnotationsCounter++;
- allTypeAnnotationContexts.add(annotationContext);
- }
- }
- attributesNumber += generateRuntimeTypeAnnotations(
- allTypeAnnotationContextsArray,
- visibleTypeAnnotationsCounter,
- invisibleTypeAnnotationsCounter);
- }
+ attributesNumber = completeRuntimeTypeAnnotations(attributesNumber,
+ null,
+ (node) -> size > 0,
+ () -> allTypeAnnotationContexts);
return attributesNumber;
}
@@ -6017,7 +6016,7 @@ public class ClassFile implements TypeConstants, TypeIds {
}
public void recordInnerClasses(TypeBinding binding, boolean onBottomForBug445231) {
if (this.innerClassesBindings == null) {
- this.innerClassesBindings = new HashMap(INNER_CLASSES_SIZE);
+ this.innerClassesBindings = new HashMap<>(INNER_CLASSES_SIZE);
}
ReferenceBinding innerClass = (ReferenceBinding) binding;
this.innerClassesBindings.put(innerClass.erasure().unannotated(), onBottomForBug445231); // should not emit yet another inner class for Outer.@Inner Inner.
@@ -6031,7 +6030,7 @@ public class ClassFile implements TypeConstants, TypeIds {
public int recordBootstrapMethod(FunctionalExpression expression) {
if (this.bootstrapMethods == null) {
- this.bootstrapMethods = new ArrayList();
+ this.bootstrapMethods = new ArrayList<>();
}
if (expression instanceof ReferenceExpression) {
for (int i = 0; i < this.bootstrapMethods.size(); i++) {
@@ -6160,23 +6159,21 @@ public class ClassFile implements TypeConstants, TypeIds {
this.contentsOffset += 2;
}
- private List filterFakeFrames(Set realJumpTargets, Map frames, int codeLength) {
+ private List<StackMapFrame> filterFakeFrames(Set<Integer> realJumpTargets, Map<Integer, StackMapFrame> frames, int codeLength) {
// no more frame to generate
// filter out "fake" frames
realJumpTargets.remove(Integer.valueOf(codeLength));
- List result = new ArrayList();
- for (Iterator iterator = realJumpTargets.iterator(); iterator.hasNext(); ) {
- Integer jumpTarget = (Integer) iterator.next();
- StackMapFrame frame = (StackMapFrame) frames.get(jumpTarget);
+ List<StackMapFrame> result = new ArrayList<>();
+ for (Iterator<Integer> iterator = realJumpTargets.iterator(); iterator.hasNext(); ) {
+ Integer jumpTarget = iterator.next();
+ StackMapFrame frame = frames.get(jumpTarget);
if (frame != null) {
result.add(frame);
}
}
- Collections.sort(result, new Comparator() {
+ Collections.sort(result, new Comparator<StackMapFrame>() {
@Override
- public int compare(Object o1, Object o2) {
- StackMapFrame frame = (StackMapFrame) o1;
- StackMapFrame frame2 = (StackMapFrame) o2;
+ public int compare(StackMapFrame frame, StackMapFrame frame2) {
return frame.pc - frame2.pc;
}
});
@@ -6397,7 +6394,7 @@ public class ClassFile implements TypeConstants, TypeIds {
}
}
- public List traverse(
+ public List<StackMapFrame> traverse(
MethodBinding methodBinding,
int maxLocals,
byte[] bytecodes,
@@ -6406,7 +6403,7 @@ public class ClassFile implements TypeConstants, TypeIds {
Map<Integer, StackMapFrame> frames,
boolean isClinit,
Scope scope) {
- Set realJumpTarget = new HashSet();
+ Set<Integer> realJumpTarget = new HashSet<>();
StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream;
int[] framePositions = stackMapFrameCodeStream.getFramePositions();
@@ -7481,11 +7478,11 @@ public class ClassFile implements TypeConstants, TypeIds {
return dimensions;
}
- private void addRealJumpTarget(Set realJumpTarget, int pc) {
+ private void addRealJumpTarget(Set<Integer> realJumpTarget, int pc) {
realJumpTarget.add(Integer.valueOf(pc));
}
- private void addRealJumpTarget(Set realJumpTarget, int pc, Map frames, StackMapFrame frame, Scope scope) {
+ private void addRealJumpTarget(Set<Integer> realJumpTarget, int pc, Map<Integer, StackMapFrame> frames, StackMapFrame frame, Scope scope) {
realJumpTarget.add(Integer.valueOf(pc));
add(frames, frame, scope);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java
index 422cc4420f..478d32d408 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java
@@ -272,7 +272,21 @@ public class AND_AND_Expression extends BinaryExpression {
codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex);
}
}
+ @Override
+ public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.left.collectPatternVariablesToScope(this.patternVarsWhenTrue, scope);
+
+ variables = this.left.getPatternVariablesWhenTrue();
+ this.addPatternVariablesWhenTrue(variables);
+ this.right.addPatternVariablesWhenTrue(variables);
+ variables = this.left.getPatternVariablesWhenFalse();
+ this.right.addPatternVariablesWhenFalse(variables);
+
+ this.right.collectPatternVariablesToScope(this.patternVarsWhenTrue, scope);
+ variables = this.right.getPatternVariablesWhenTrue();
+ this.addPatternVariablesWhenTrue(variables);
+ }
@Override
public boolean isCompactableOperation() {
return false;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
index 35f1d8a40b..5db2554a15 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
@@ -176,8 +176,7 @@ public abstract class ASTNode implements TypeConstants, TypeIds {
public static final int GenerateCheckcast = Bit7;
public static final int UnsafeCast = Bit8;
- // for name references (Java 14 addition - Records preview - Bit18)
- public static final int RestrictiveFlagMASK = Bit1 | Bit2 | Bit3 | Bit18 ;
+ public static final int RestrictiveFlagMASK = Bit1 | Bit2 | Bit3 ;
// for local decls
public static final int IsTypeElided = Bit2; // type elided lambda argument.
@@ -676,6 +675,10 @@ public abstract class ASTNode implements TypeConstants, TypeIds {
output.append("abstract "); //$NON-NLS-1$
if ((modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0)
output.append("default "); //$NON-NLS-1$
+ if ((modifiers & ExtraCompilerModifiers.AccNonSealed) != 0)
+ output.append("non-sealed "); //$NON-NLS-1$
+ if ((modifiers & ExtraCompilerModifiers.AccSealed) != 0)
+ output.append("sealed "); //$NON-NLS-1$
return output;
}
@@ -1239,7 +1242,6 @@ public abstract class ASTNode implements TypeConstants, TypeIds {
}
// TODO: Null Analysis Address via bug 562478?
- recipientTargetMask |= TagBits.AnnotationForTypeUse;
List<AnnotationBinding> relevantAnnotations = new ArrayList<>();
Annotation[] filteredAnnotations = ASTNode.getRelevantAnnotations(annotations, recipientTargetMask, relevantAnnotations);
AnnotationBinding [] recipientAnnotations = relevantAnnotations.toArray(new AnnotationBinding[relevantAnnotations.size()]);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index 9963153f79..55d41fd830 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -240,9 +240,6 @@ public abstract class AbstractMethodDeclaration
}
}
}
- if (methodArguments[i].duplicateCheckObligation != null) {
- methodArguments[i].duplicateCheckObligation.accept(flowInfo);
- }
// tag parameters as being set:
flowInfo.markAsDefinitelyAssigned(methodArguments[i].binding);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
index 2a00cbc764..68c36417b2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
@@ -80,9 +80,13 @@ public class Argument extends LocalDeclaration {
if ((this.binding.tagBits & TagBits.AnnotationResolved) == 0) {
Annotation[] annots = this.annotations;
long sourceLevel = scope.compilerOptions().sourceLevel;
- if (sourceLevel >= ClassFileConstants.JDK14 && annots == null)
+ if (sourceLevel >= ClassFileConstants.JDK14 && annots == null) {
annots = getCorrespondingRecordComponentAnnotationsIfApplicable(scope.referenceMethod());
- resolveAnnotations(scope, annots, this.binding, true);
+ annots = ASTNode.copyRecordComponentAnnotations(scope,
+ this.binding, annots);
+ }
+ if (annots != null)
+ resolveAnnotations(scope, annots, this.binding, true);
if (sourceLevel >= ClassFileConstants.JDK1_8) {
Annotation.isTypeUseCompatible(this.type, scope, annots);
scope.validateNullAnnotation(this.binding.tagBits, this.type, annots);
@@ -100,11 +104,13 @@ public class Argument extends LocalDeclaration {
ReferenceBinding referenceBinding = methodBinding== null ? null : methodBinding.declaringClass;
if (referenceBinding instanceof SourceTypeBinding) {
SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) referenceBinding;
- assert (sourceTypeBinding.isRecord());
+ assert (sourceTypeBinding.isRecord()); // CHECK: Is this really necessary?
sourceTypeBinding.components();
RecordComponentBinding recordComponentBinding = sourceTypeBinding.getRecordComponent(this.name);
- RecordComponent recordComponent = recordComponentBinding.sourceRecordComponent();
- return recordComponent.annotations;
+ if (recordComponentBinding != null) {
+ RecordComponent recordComponent = recordComponentBinding.sourceRecordComponent();
+ return recordComponent.annotations;
+ }
}
}
return null;
@@ -118,15 +124,7 @@ public class Argument extends LocalDeclaration {
final boolean localExists = existingVariable instanceof LocalVariableBinding;
if (localExists && this.hiddenVariableDepth == 0) {
if ((this.bits & ASTNode.ShadowsOuterLocal) != 0 && scope.isLambdaSubscope()) {
- if ((((LocalVariableBinding) existingVariable).modifiers & ExtraCompilerModifiers.AccPatternVariable) != 0) {
- this.duplicateCheckObligation = (flowInfo) -> {
- if (flowInfo.isDefinitelyAssigned((LocalVariableBinding) existingVariable)) {
- scope.problemReporter().lambdaRedeclaresArgument(this);
- }
- };
- } else {
- scope.problemReporter().lambdaRedeclaresArgument(this);
- }
+ scope.problemReporter().lambdaRedeclaresArgument(this);
} else if (scope.referenceContext instanceof CompactConstructorDeclaration) {
// skip error reporting - hidden params - already reported in record components
} else {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
index 1ad2696207..5c5b8bdaaf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -31,7 +31,6 @@ import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
-@SuppressWarnings({"rawtypes"})
public class ArrayAllocationExpression extends Expression {
public TypeReference type;
@@ -230,7 +229,7 @@ public class ArrayAllocationExpression extends Expression {
visitor.endVisit(this, scope);
}
- public void getAllAnnotationContexts(int targetType, int info, List allTypeAnnotationContexts) {
+ public void getAllAnnotationContexts(int targetType, int info, List<AnnotationContext> allTypeAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allTypeAnnotationContexts);
this.type.traverse(collector, (BlockScope) null);
if (this.annotationsOnDimensions != null) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
index 6736fcdca0..12dde6fd9a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
@@ -1821,9 +1821,26 @@ public boolean containsPatternVariable() {
return this.left.containsPatternVariable() || this.right.containsPatternVariable();
}
@Override
+public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.addPatternVariablesWhenTrue(variables);
+ this.left.addPatternVariablesWhenTrue(this.patternVarsWhenTrue);
+ this.right.addPatternVariablesWhenTrue(this.patternVarsWhenTrue);
+ this.left.addPatternVariablesWhenFalse(this.patternVarsWhenFalse);
+ this.right.addPatternVariablesWhenFalse(this.patternVarsWhenFalse);
+ this.left.collectPatternVariablesToScope(this.patternVarsWhenTrue, scope);
+ this.right.collectPatternVariablesToScope(this.patternVarsWhenTrue, scope);
+}
+@Override
public TypeBinding resolveType(BlockScope scope) {
// keep implementation in sync with CombinedBinaryExpression#resolveType
// and nonRecursiveResolveTypeUpwards
+ if(this.patternVarsWhenFalse == null && this.patternVarsWhenTrue == null &&
+ this.containsPatternVariable()) {
+ // the null check is to guard against a second round of collection.
+ // This usually doesn't happen,
+ // except when we call collectPatternVariablesToScope() from here
+ this.collectPatternVariablesToScope(null, scope);
+ }
boolean leftIsCast, rightIsCast;
if ((leftIsCast = this.left instanceof CastExpression) == true) this.left.bits |= ASTNode.DisableUnnecessaryCastCheck; // will check later on
TypeBinding leftType = this.left.resolveType(scope);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompactConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompactConstructorDeclaration.java
index 88fa4f59fc..d91dea4afc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompactConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompactConstructorDeclaration.java
@@ -12,9 +12,14 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.parser.Parser;
@@ -31,39 +36,58 @@ public class CompactConstructorDeclaration extends ConstructorDeclaration {
this.containsSwitchWithTry = parser.switchWithTry;
}
@Override
- protected void checkAndGenerateFieldAssignment(FlowContext flowContext, FlowInfo flowInfo, FieldBinding field) {
- if (field.isStatic() ||
- flowInfo.isDefinitelyAssigned(field) || flowInfo.isPotentiallyAssigned(field))
+ public void analyseCode(ClassScope classScope, InitializationFlowContext initializerFlowContext, FlowInfo flowInfo, int initialReachMode) {
+ try {
+ this.scope.isCompactConstructorScope = true;
+ super.analyseCode(classScope, initializerFlowContext, flowInfo, initialReachMode);
+ } finally {
+ this.scope.isCompactConstructorScope = false;
+ }
+ }
+ @Override
+ protected void doFieldReachAnalysis(FlowInfo flowInfo, FieldBinding[] fields) {
+ // do nothing
+ }
+ @Override
+ protected void checkAndGenerateFieldAssignment(FlowContext flowContext, FlowInfo flowInfo, FieldBinding[] fields) {
+ this.scope.isCompactConstructorScope = false;
+ if (fields == null)
return;
- assert field.isFinal();
- /* JLS 14 8.10.5 Compact Record Constructor Declarations
- * In addition, at the end of the body of the compact constructor, all the fields
- * corresponding to the record components of R that are definitely unassigned
- * (16 (Definite Assignment)) are implicitly initialized to the value of the
- * corresponding formal parameter. These fields are implicitly initialized in the
- * order that they are declared in the record component list.
+ /* JLS 15 Record addendum Sec 8.10.4 All fields corresponding to the record components of the
+ * record class are implicitly initialized to the value of the corresponding formal
+ * parameter after the body of the compact constructor.
+ * These fields are implicitly initialized in the order that they are declared
+ * in the record component list.
*/
- FieldReference lhs = new FieldReference(field.name,0);
- lhs.receiver = new ThisReference(0, 0);
- //TODO: Check whether anything has to be done for null analysis.
- Assignment assignment = new Assignment(lhs, new SingleNameReference(field.name, 0), 0);
- assignment.resolveType(this.scope);
- assignment.analyseCode(this.scope, flowContext, flowInfo);
- assignment.bits |= ASTNode.IsImplicit;
- assert flowInfo.isDefinitelyAssigned(field);
- Statement[] stmts = this.statements;
+ List<Statement> fieldAssignments = new ArrayList<>();
+ for (FieldBinding field : fields) {
+ if (field.isStatic())
+ continue;
+ assert field.isFinal();
+
+ FieldReference lhs = new FieldReference(field.name,0);
+ lhs.receiver = new ThisReference(0, 0);
+ //TODO: Check whether anything has to be done for null analysis.
+ Assignment assignment = new Assignment(lhs, new SingleNameReference(field.name, 0), 0);
+ assignment.resolveType(this.scope);
+ assignment.analyseCode(this.scope, flowContext, flowInfo);
+ assignment.bits |= ASTNode.IsImplicit;
+ assert flowInfo.isDefinitelyAssigned(field);
+ fieldAssignments.add(assignment);
+ }
+ if (fieldAssignments.isEmpty())
+ return;
+
+ Statement[] fa = fieldAssignments.toArray(new Statement[0]);
if (this.statements == null) {
- this.statements = new Statement[] { assignment };
- } else {
- int len = this.statements.length;
- System.arraycopy(
- this.statements,
- 0,
- stmts = new Statement[len + 1],
- 0,
- len);
- stmts[len] = assignment;
- this.statements = stmts;
+ this.statements = fa;
+ return;
}
+ int len = this.statements.length;
+ int fLen = fa.length;
+ Statement[] stmts = new Statement[len + fLen];
+ System.arraycopy(this.statements, 0, stmts, 0, len);
+ System.arraycopy(fa, 0, stmts, len, fLen);
+ this.statements = stmts;
}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
index 1685e69a74..1ce669c2ab 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -453,7 +453,20 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext,
this.valueIfTrue.addPatternVariables(scope, codeStream);
this.valueIfFalse.addPatternVariables(scope, codeStream);
}
-
+ @Override
+ public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.condition.collectPatternVariablesToScope(this.patternVarsWhenTrue, scope);
+
+ variables = this.condition.getPatternVariablesWhenTrue();
+ this.valueIfTrue.addPatternVariablesWhenTrue(variables);
+ this.valueIfFalse.addPatternVariablesWhenFalse(variables);
+ this.valueIfTrue.collectPatternVariablesToScope(variables, scope);
+
+ variables = this.condition.getPatternVariablesWhenFalse();
+ this.valueIfTrue.addPatternVariablesWhenFalse(variables);
+ this.valueIfFalse.addPatternVariablesWhenTrue(variables);
+ this.valueIfFalse.collectPatternVariablesToScope(variables, scope);
+ }
@Override
public TypeBinding resolveType(BlockScope scope) {
// JLS3 15.25
@@ -470,7 +483,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext,
this.valueIfFalse.setExpectedType(this.expectedType);
}
}
-
+ if (this.condition.containsPatternVariable()) {
+ collectPatternVariablesToScope(null, scope);
+ }
if (this.constant != Constant.NotAConstant) {
this.constant = Constant.NotAConstant;
TypeBinding conditionType = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index af3344f5da..e03607f2f0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -104,7 +104,8 @@ public void analyseCode(ClassScope classScope, InitializationFlowContext initial
// otherwise default super constructor exists, so go ahead and complain unused.
}
// complain unused
- this.scope.problemReporter().unusedPrivateConstructor(this);
+ if ((this.bits & ASTNode.IsImplicit) == 0)
+ this.scope.problemReporter().unusedPrivateConstructor(this);
}
// check constructor recursion, once all constructor got resolved
@@ -203,27 +204,8 @@ public void analyseCode(ClassScope classScope, InitializationFlowContext initial
&& (this.constructorCall.accessMode != ExplicitConstructorCall.This)) {
flowInfo = flowInfo.mergedWith(constructorContext.initsOnReturn);
FieldBinding[] fields = this.binding.declaringClass.fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field = fields[i];
- checkAndGenerateFieldAssignment(initializerFlowContext, flowInfo, field);
- if (!field.isStatic() && !flowInfo.isDefinitelyAssigned(field)) {
- if (field.isFinal()) {
- this.scope.problemReporter().uninitializedBlankFinalField(
- field,
- ((this.bits & ASTNode.IsDefaultConstructor) != 0)
- ? (ASTNode) this.scope.referenceType().declarationOf(field.original())
- : this);
- } else if (field.isNonNull() || field.type.isFreeTypeVariable()) {
- FieldDeclaration fieldDecl = this.scope.referenceType().declarationOf(field.original());
- if (!isValueProvidedUsingAnnotation(fieldDecl))
- this.scope.problemReporter().uninitializedNonNullField(
- field,
- ((this.bits & ASTNode.IsDefaultConstructor) != 0)
- ? (ASTNode) fieldDecl
- : this);
- }
- }
- }
+ checkAndGenerateFieldAssignment(initializerFlowContext, flowInfo, fields);
+ doFieldReachAnalysis(flowInfo, fields);
}
// check unreachable catch blocks
constructorContext.complainIfUnusedExceptionHandlers(this);
@@ -234,8 +216,30 @@ public void analyseCode(ClassScope classScope, InitializationFlowContext initial
this.ignoreFurtherInvestigation = true;
}
}
+protected void doFieldReachAnalysis(FlowInfo flowInfo, FieldBinding[] fields) {
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field = fields[i];
+ if (!field.isStatic() && !flowInfo.isDefinitelyAssigned(field)) {
+ if (field.isFinal()) {
+ this.scope.problemReporter().uninitializedBlankFinalField(
+ field,
+ ((this.bits & ASTNode.IsDefaultConstructor) != 0)
+ ? (ASTNode) this.scope.referenceType().declarationOf(field.original())
+ : this);
+ } else if (field.isNonNull() || field.type.isFreeTypeVariable()) {
+ FieldDeclaration fieldDecl = this.scope.referenceType().declarationOf(field.original());
+ if (!isValueProvidedUsingAnnotation(fieldDecl))
+ this.scope.problemReporter().uninitializedNonNullField(
+ field,
+ ((this.bits & ASTNode.IsDefaultConstructor) != 0)
+ ? (ASTNode) fieldDecl
+ : this);
+ }
+ }
+ }
+}
-protected void checkAndGenerateFieldAssignment(FlowContext flowContext, FlowInfo flowInfo, FieldBinding field) {
+protected void checkAndGenerateFieldAssignment(FlowContext flowContext, FlowInfo flowInfo, FieldBinding[] fields) {
return;
}
boolean isValueProvidedUsingAnnotation(FieldDeclaration fieldDecl) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
index 3c13922f01..35d30676e2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -227,10 +227,22 @@ public StringBuffer printStatement(int indent, StringBuffer output) {
@Override
public void resolve(BlockScope scope) {
- TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
- this.condition.computeConversion(scope, type, type);
- if (this.action != null)
- this.action.resolve(scope);
+ if (this.condition.containsPatternVariable()) {
+ this.condition.collectPatternVariablesToScope(null, scope);
+ LocalVariableBinding[] patternVariablesInFalseScope = this.condition.getPatternVariablesWhenFalse();
+ TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
+ this.condition.computeConversion(scope, type, type);
+ if (this.action != null) {
+ this.action.resolve(scope);
+ this.action.injectPatternVariablesIfApplicable(patternVariablesInFalseScope, scope,
+ (statement) -> { return !statement.breaksOut(null);});
+ }
+ } else {
+ TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
+ this.condition.computeConversion(scope, type, type);
+ if (this.action != null)
+ this.action.resolve(scope);
+ }
}
@Override
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index 0192774c46..64971275ee 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -791,6 +791,37 @@ public void addPatternVariables(BlockScope scope, CodeStream codeStream) {
public boolean containsPatternVariable() {
return false;
}
+public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ new ASTVisitor() {
+ LocalVariableBinding[] patternVariablesInScope;
+ @Override
+ public boolean visit(Argument argument, BlockScope skope) {
+ // Most likely to be a lambda parameter
+ argument.addPatternVariablesWhenTrue(this.patternVariablesInScope);
+ return true;
+ }
+ @Override
+ public boolean visit(
+ QualifiedNameReference nameReference,
+ BlockScope skope) {
+ nameReference.addPatternVariablesWhenTrue(this.patternVariablesInScope);
+ return true;
+ }
+ @Override
+ public boolean visit(
+ SingleNameReference nameReference,
+ BlockScope skope) {
+ nameReference.addPatternVariablesWhenTrue(this.patternVariablesInScope);
+ return true;
+ }
+
+ public void propagatePatternVariablesInScope(LocalVariableBinding[] vars, BlockScope skope) {
+ this.patternVariablesInScope = vars;
+ Expression.this.traverse(this, skope);
+ }
+ }.propagatePatternVariablesInScope(variables, scope);
+}
+
/**
* Default generation of a boolean value
* @param currentScope
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
index 94e6096079..57f022a973 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
@@ -39,7 +39,6 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.util.Util;
-@SuppressWarnings("rawtypes")
public class FieldDeclaration extends AbstractVariableDeclaration {
public FieldBinding binding;
@@ -154,7 +153,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
// }
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
-public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
+public void getAllAnnotationContexts(int targetType, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this.type, targetType, allAnnotationContexts);
for (int i = 0, max = this.annotations.length; i < max; i++) {
Annotation annotation = this.annotations[i];
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
index e5113e716b..3fa15be439 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
@@ -114,7 +114,8 @@ public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowConte
&& this.receiver.isThis()
&& !(this.receiver instanceof QualifiedThisReference)
&& ((this.receiver.bits & ASTNode.ParenthesizedMASK) == 0) // (this).x is forbidden
- && currentScope.allowBlankFinalFieldAssignment(this.binding)) {
+ && currentScope.allowBlankFinalFieldAssignment(this.binding)
+ && !currentScope.methodScope().isCompactConstructorScope) {
if (flowInfo.isPotentiallyAssigned(this.binding)) {
currentScope.problemReporter().duplicateInitializationOfBlankFinalField(
this.binding,
@@ -124,8 +125,11 @@ public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowConte
}
flowInfo.markAsDefinitelyAssigned(this.binding);
} else {
+ if (currentScope.methodScope().isCompactConstructorScope)
+ currentScope.problemReporter().recordIllegalExplicitFinalFieldAssignInCompactConstructor(this.binding, this);
+ else
// assigning a final field outside an initializer or constructor or wrong reference
- currentScope.problemReporter().cannotAssignToFinalField(this.binding, this);
+ currentScope.problemReporter().cannotAssignToFinalField(this.binding, this);
}
} else if (this.binding.isNonNull() || this.binding.type.isTypeVariable()) {
// in a context where it can be assigned?
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
index 8e059b8dc3..5f9c904633 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
@@ -21,10 +21,16 @@ package org.eclipse.jdt.internal.compiler.ast;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
-import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
+import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
+import org.eclipse.jdt.internal.compiler.flow.FlowContext;
+import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext;
+import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo;
import org.eclipse.jdt.internal.compiler.impl.Constant;
-import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class ForStatement extends Statement {
@@ -244,7 +250,6 @@ public class ForStatement extends Statement {
this.condition.updateFlowOnBooleanResult(mergedInfo, false);
return mergedInfo;
}
-
/**
* For statement code generation
*
@@ -403,16 +408,13 @@ public class ForStatement extends Statement {
@Override
public void resolve(BlockScope upperScope) {
+ LocalVariableBinding[] patternVariablesInTrueScope = null;
+ LocalVariableBinding[] patternVariablesInFalseScope = null;
+
if (this.condition != null && this.condition.containsPatternVariable()) {
- this.condition.traverse(new ASTVisitor() {
- @Override
- public boolean visit(
- InstanceOfExpression instanceOfExpression,
- BlockScope sc) {
- instanceOfExpression.resolvePatternVariable(upperScope);
- return true; // We want to resolve all pattern variables if any inside the condition
- }
- }, upperScope);
+ this.condition.collectPatternVariablesToScope(null, upperScope);
+ patternVariablesInTrueScope = this.condition.getPatternVariablesWhenTrue();
+ patternVariablesInFalseScope = this.condition.getPatternVariablesWhenFalse();
}
// use the scope that will hold the init declarations
this.scope = (this.bits & ASTNode.NeededScope) != 0 ? new BlockScope(upperScope) : upperScope;
@@ -424,10 +426,15 @@ public class ForStatement extends Statement {
this.condition.computeConversion(this.scope, type, type);
}
if (this.increments != null)
- for (int i = 0, length = this.increments.length; i < length; i++)
- this.increments[i].resolve(this.scope);
- if (this.action != null)
- this.action.resolve(this.scope);
+ for (int i = 0, length = this.increments.length; i < length; i++) {
+ this.increments[i].resolveWithPatternVariablesInScope(patternVariablesInTrueScope, this.scope);
+ }
+
+ if (this.action != null) {
+ this.action.resolveWithPatternVariablesInScope(patternVariablesInTrueScope, this.scope);
+ this.action.injectPatternVariablesIfApplicable(patternVariablesInFalseScope, this.scope,
+ (statement) -> { return !statement.breaksOut(null);});
+ }
}
@Override
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
index 1cb95e1394..f569e37a3b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
@@ -158,7 +158,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
flowContext.conditionalLevel--;
return mergedInfo;
}
-
/**
* If code generation
*
@@ -217,7 +216,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
// May loose some local variable initializations : affecting the local variable attributes
if (this.elseInitStateIndex != -1) {
codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
+ currentScope,
this.elseInitStateIndex);
codeStream.addDefinitelyAssignedVariables(currentScope, this.elseInitStateIndex);
}
@@ -276,8 +275,7 @@ public StringBuffer printStatement(int indent, StringBuffer output) {
}
return output;
}
-@Override
-public void resolve(BlockScope scope) {
+private void resolveIfStatement(BlockScope scope) {
TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
this.condition.computeConversion(scope, type, type);
if (this.thenStatement != null)
@@ -285,6 +283,31 @@ public void resolve(BlockScope scope) {
if (this.elseStatement != null)
this.elseStatement.resolve(scope);
}
+@Override
+public void resolve(BlockScope scope) {
+ if (this.condition.containsPatternVariable()) {
+ this.condition.collectPatternVariablesToScope(null, scope);
+ LocalVariableBinding[] patternVariablesInTrueScope = this.condition.getPatternVariablesWhenTrue();
+ LocalVariableBinding[] patternVariablesInFalseScope = this.condition.getPatternVariablesWhenFalse();
+ TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
+ this.condition.computeConversion(scope, type, type);
+
+ if (this.thenStatement != null) {
+ this.thenStatement.resolveWithPatternVariablesInScope(patternVariablesInTrueScope, scope);
+ }
+ if (this.elseStatement != null) {
+ this.elseStatement.resolveWithPatternVariablesInScope(patternVariablesInFalseScope, scope);
+ }
+ if (this.thenStatement != null)
+ this.thenStatement.injectPatternVariablesIfApplicable(patternVariablesInFalseScope, scope,
+ (statement) -> { return statement.doesNotCompleteNormally();});
+ if (this.elseStatement != null)
+ this.elseStatement.injectPatternVariablesIfApplicable(patternVariablesInTrueScope, scope,
+ (statement) -> { return statement.doesNotCompleteNormally();});
+ } else {
+ resolveIfStatement(scope);
+ }
+}
@Override
public void traverse(ASTVisitor visitor, BlockScope blockScope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
index 418fd906e1..f23a3c4f89 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
@@ -24,6 +24,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationPosition;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
@@ -91,9 +92,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
}
}
if (this.elementVariable != null) {
- if (this.elementVariable.duplicateCheckObligation != null) {
- this.elementVariable.duplicateCheckObligation.accept(flowInfo);
- }
initsWhenTrue.markAsDefinitelyAssigned(this.elementVariable.binding);
}
return (initsWhenTrue == null) ? flowInfo :
@@ -250,14 +248,58 @@ public void addPatternVariables(BlockScope currentScope, CodeStream codeStream)
codeStream.addVisibleLocalVariable(this.elementVariable.binding);
}
}
-public void resolvePatternVariable(BlockScope scope) {
- if (this.elementVariable != null && this.elementVariable.binding == null) {
+public boolean resolvePatternVariable(BlockScope scope) {
+ if (this.elementVariable == null) return false;
+ if (this.elementVariable.binding == null) {
this.elementVariable.resolve(scope, true);
+ // Kludge - to remove the AccBlankFinal added by the LocalDeclaration#resolve() due to the
+ // missing initializer
+ this.elementVariable.modifiers &= ~ExtraCompilerModifiers.AccBlankFinal;
this.elementVariable.binding.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
+ this.elementVariable.binding.modifiers |= ExtraCompilerModifiers.AccUnresolved; // TODO: Change to a different mechanism
this.elementVariable.binding.useFlag = LocalVariableBinding.USED;
// Why cant this be done in the constructor?
this.type = this.elementVariable.type;
}
+ return true;
+}
+@Override
+public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.expression.collectPatternVariablesToScope(this.patternVarsWhenTrue, scope);
+ if (this.elementVariable != null) {
+ if (this.elementVariable.binding == null) {
+ resolvePatternVariable(scope);
+ if (variables != null) {
+ for (LocalVariableBinding variable : variables) {
+ if (CharOperation.equals(this.elementVariable.name, variable.name)) {
+ scope.problemReporter().redefineLocal(this.elementVariable);
+ }
+ }
+ }
+ }
+ if (this.patternVarsWhenTrue == null) {
+ this.patternVarsWhenTrue = new LocalVariableBinding[1];
+ this.patternVarsWhenTrue[0] = this.elementVariable.binding;
+ } else {
+ this.addPatternVariablesWhenTrue(new LocalVariableBinding[] {this.elementVariable.binding});
+ }
+ }
+
+}
+@Override
+public void addPatternVariablesWhenTrue(LocalVariableBinding[] vars) {
+ if (this.patternVarsWhenTrue == null) {
+ this.getPatternVariablesWhenTrue();
+ }
+ if (vars == null || vars.length == 0) return;
+ if (this.patternVarsWhenTrue == null) {
+ this.patternVarsWhenTrue = vars;
+ } else {
+ int oldSize = this.patternVarsWhenTrue.length;
+ int newLength = oldSize + vars.length;
+ System.arraycopy(this.patternVarsWhenTrue, 0, (this.patternVarsWhenTrue = new LocalVariableBinding[newLength]), 0, oldSize);
+ System.arraycopy(vars, 0, this.patternVarsWhenTrue, oldSize, vars.length);
+ }
}
@Override
public boolean containsPatternVariable() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
index ceb1307c0f..cd8de06778 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -146,6 +146,27 @@ public class Javadoc extends ASTNode {
}
}
}
+ } else if (expression instanceof JavadocModuleReference) {
+ JavadocModuleReference modRef = (JavadocModuleReference) expression;
+ if (modRef.typeReference != null) {
+ if (modRef.typeReference.sourceStart == start) {
+ return modRef.typeReference;
+ }
+ }
+ } else if (expression instanceof JavadocFieldReference) {
+ JavadocFieldReference fieldRef = (JavadocFieldReference) expression;
+ if (fieldRef.receiver instanceof JavadocModuleReference) {
+ JavadocModuleReference modRef = (JavadocModuleReference) fieldRef.receiver;
+ if (modRef.sourceStart == start) {
+ return modRef;
+ } else {
+ if (modRef.typeReference != null) {
+ if (modRef.typeReference.sourceStart == start) {
+ return modRef.typeReference;
+ }
+ }
+ }
+ }
}
}
}
@@ -478,6 +499,22 @@ public class Javadoc extends ASTNode {
verifyTypeReference(reference, reference, scope, source15, resolvedType, resolvedType.modifiers);
}
+ if (!hasProblems && (reference instanceof JavadocModuleReference)) {
+ JavadocModuleReference ref= (JavadocModuleReference)reference;
+ ref.resolve(scope);
+ ModuleReference mRef = ref.getModuleReference();
+ if (mRef != null) {
+ ModuleBinding mType = mRef.resolve(scope);
+ if (mType != null && verifyModuleReference(reference, reference, scope, source15, mType, mType.modifiers)) {
+ TypeReference tRef= ref.getTypeReference();
+ if ((tRef instanceof JavadocSingleTypeReference || tRef instanceof JavadocQualifiedTypeReference) && tRef.resolvedType instanceof ReferenceBinding) {
+ ReferenceBinding resolvedType = (ReferenceBinding) tRef.resolvedType;
+ verifyTypeReference(reference, reference, scope, source15, resolvedType, resolvedType.modifiers);
+ }
+ }
+ }
+ }
+
// Verify that message reference are not used for @value tags
if (reference instanceof JavadocMessageSend) {
JavadocMessageSend msgSend = (JavadocMessageSend) reference;
@@ -1143,6 +1180,40 @@ public class Javadoc extends ASTNode {
}
}
+ private boolean verifyModuleReference(Expression reference, Expression typeReference, Scope scope, boolean source15, ModuleBinding moduleType, int modifiers) {
+ boolean bindingFound = false;
+ if (moduleType!= null && moduleType.isValidBinding()) {
+ int scopeModifiers = -1;
+
+ ModuleBinding mBinding = scope.module();
+
+ if (mBinding == null) {
+ scope.problemReporter().javadocInvalidModuleQualification(typeReference.sourceStart, typeReference.sourceEnd, scopeModifiers);
+ return bindingFound;
+ }
+
+ if (mBinding.equals(moduleType)) {
+ bindingFound = true;
+ } else {
+ ModuleBinding[] bindings = mBinding.getAllRequiredModules();
+ for (ModuleBinding binding : bindings) {
+ if (moduleType.equals(binding)) {
+ bindingFound = true;
+ break;
+ }
+ }
+ }
+
+ if (!bindingFound) {
+ if (!canBeSeen(scope.problemReporter().options.reportInvalidJavadocTagsVisibility, moduleType.modifiers)) {
+ scope.problemReporter().javadocHiddenReference(typeReference.sourceStart, typeReference.sourceEnd, scope, moduleType.modifiers);
+ return bindingFound;
+ }
+ }
+ }
+ return bindingFound;
+ }
+
@Override
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocModuleReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocModuleReference.java
new file mode 100644
index 0000000000..5876d9bdb8
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocModuleReference.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.ast;
+
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
+import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+
+
+public class JavadocModuleReference extends Expression implements IJavadocTypeReference {
+
+ public int tagSourceStart, tagSourceEnd;
+ public TypeReference typeReference;
+ public ModuleReference moduleReference;
+
+ public JavadocModuleReference(char[][] sources, long[] pos, int tagStart, int tagEnd) {
+ super();
+ this.moduleReference = new ModuleReference(sources, pos);
+ this.tagSourceStart = tagStart;
+ this.tagSourceEnd = tagEnd;
+ this.sourceStart = this.moduleReference.sourceStart;
+ this.sourceEnd = this.moduleReference.sourceEnd;
+ this.bits |= ASTNode.InsideJavadoc;
+ }
+
+ /* (non-Javadoc)
+ * Redefine to capture javadoc specific signatures
+ * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
+ */
+ @Override
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+
+ @Override
+ public int getTagSourceStart() {
+ return this.tagSourceStart;
+ }
+
+ @Override
+ public int getTagSourceEnd() {
+ return this.tagSourceEnd;
+ }
+
+ public TypeReference getTypeReference() {
+ return this.typeReference;
+ }
+
+ public void setTypeReference(TypeReference typeReference) {
+ this.typeReference = typeReference;
+ if (this.typeReference != null) {
+ this.sourceEnd = this.typeReference.sourceEnd;
+ }
+ }
+
+ public ModuleReference getModuleReference() {
+ return this.moduleReference;
+ }
+
+ public void setModuleReference(ModuleReference moduleReference) {
+ this.moduleReference = moduleReference;
+ this.sourceStart = this.moduleReference.sourceStart;
+ this.sourceStart = this.moduleReference.sourceEnd;
+ }
+
+ @Override
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ if (this.moduleReference != null) {
+ output.append(this.moduleReference.moduleName);
+ }
+ output.append('/');
+ if (this.typeReference != null) {
+ this.typeReference.printExpression(indent, output);
+ }
+ return output;
+ }
+
+ public ModuleBinding resolve(Scope scope) {
+ return this.moduleReference.resolve(scope);
+ }
+
+ private ModuleBinding resolveModule(BlockScope scope) {
+ return this.moduleReference.resolve(scope);
+ }
+
+ private ModuleBinding resolveModule(ClassScope scope) {
+ return this.moduleReference.resolve(scope);
+ }
+
+ @Override
+ public TypeBinding resolveType(BlockScope blockScope) {
+ this.resolveModule(blockScope);
+ if (this.moduleReference.binding != null
+ && this.typeReference != null) {
+ return this.typeReference.resolveType(blockScope);
+ }
+ return null;
+ }
+
+ @Override
+ public TypeBinding resolveType(ClassScope classScope) {
+ this.resolveModule(classScope);
+ assert(this.moduleReference.binding != null);
+ if (this.typeReference != null) {
+ return this.typeReference.resolveType(classScope, -1);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java
index 5987709196..a59e0a28e9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java
@@ -37,7 +37,7 @@ public class JavadocSingleNameReference extends SingleNameReference {
*/
public void resolve(BlockScope scope, boolean warn, boolean considerParamRefAsUsage) {
- LocalVariableBinding variableBinding = scope.findVariable(this.token);
+ LocalVariableBinding variableBinding = scope.findVariable(this.token, this);
if (variableBinding != null && variableBinding.isValidBinding() && ((variableBinding.tagBits & TagBits.IsArgument) != 0)) {
this.binding = variableBinding;
if (considerParamRefAsUsage) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
index de737e275e..0b6454b354 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -45,7 +45,6 @@ import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.VANILLA_CO
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.function.Consumer;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.impl.*;
@@ -56,17 +55,10 @@ import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner;
-@SuppressWarnings("rawtypes")
public class LocalDeclaration extends AbstractVariableDeclaration {
public LocalVariableBinding binding;
- /**
- * For pattern variable, resolve() may store here an obligation to be checked when we have
- * a flow info that tells us whether a potential duplicates is in fact in scope.
- */
- Consumer<FlowInfo> duplicateCheckObligation;
-
public LocalDeclaration(
char[] name,
int sourceStart,
@@ -125,9 +117,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
// no need to inform enclosing try block since its locals won't get
// known by the finally block
}
- if (this.duplicateCheckObligation != null) {
- this.duplicateCheckObligation.accept(flowInfo);
- }
return flowInfo;
}
@@ -197,13 +186,13 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
}
// for local variables
- public void getAllAnnotationContexts(int targetType, LocalVariableBinding localVariable, List allAnnotationContexts) {
+ public void getAllAnnotationContexts(int targetType, LocalVariableBinding localVariable, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, localVariable, allAnnotationContexts);
this.traverseWithoutInitializer(collector, (BlockScope) null);
}
// for arguments
- public void getAllAnnotationContexts(int targetType, int parameterIndex, List allAnnotationContexts) {
+ public void getAllAnnotationContexts(int targetType, int parameterIndex, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, parameterIndex, allAnnotationContexts);
this.traverse(collector, (BlockScope) null);
}
@@ -309,23 +298,12 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
Binding existingVariable = scope.getBinding(this.name, Binding.VARIABLE, this, false /*do not resolve hidden field*/);
if (existingVariable != null && existingVariable.isValidBinding()){
boolean localExists = existingVariable instanceof LocalVariableBinding;
- if (localExists && (isPatternVariable
- || (((LocalVariableBinding) existingVariable).modifiers & ExtraCompilerModifiers.AccPatternVariable) != 0))
- {
- // Do this only if either one of them is a pattern variable.
- this.duplicateCheckObligation = (flowInfo) -> {
- if (flowInfo.isDefinitelyAssigned((LocalVariableBinding) existingVariable)) {
- scope.problemReporter().redefineLocal(this);
- }
- };
+ if (localExists && (this.bits & ASTNode.ShadowsOuterLocal) != 0 && scope.isLambdaSubscope() && this.hiddenVariableDepth == 0) {
+ scope.problemReporter().lambdaRedeclaresLocal(this);
+ } else if (localExists && this.hiddenVariableDepth == 0) {
+ scope.problemReporter().redefineLocal(this);
} else {
- if (localExists && (this.bits & ASTNode.ShadowsOuterLocal) != 0 && scope.isLambdaSubscope() && this.hiddenVariableDepth == 0) {
- scope.problemReporter().lambdaRedeclaresLocal(this);
- } else if (localExists && this.hiddenVariableDepth == 0) {
- scope.problemReporter().redefineLocal(this);
- } else {
- scope.problemReporter().localVariableHiding(this, existingVariable, false);
- }
+ scope.problemReporter().localVariableHiding(this, existingVariable, false);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
index 86d5f9069a..61bbfc1044 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
@@ -279,7 +279,8 @@ public class MethodDeclaration extends AbstractMethodDeclaration {
// check @Override annotation
final CompilerOptions compilerOptions = this.scope.compilerOptions();
checkOverride: {
- if (this.binding == null) break checkOverride;
+ // For a record component accessor method, don't bother with checking for override (JLS 15 9.6.4.4)
+ if (this.binding == null || recordComponent != null) break checkOverride;
long complianceLevel = compilerOptions.complianceLevel;
if (complianceLevel < ClassFileConstants.JDK1_5) break checkOverride;
int bindingModifiers = this.binding.modifiers;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java
index e35c399cc7..aeaab4f884 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java
@@ -277,7 +277,26 @@ public class OR_OR_Expression extends BinaryExpression {
codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex);
}
}
+ @Override
+ public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.left.collectPatternVariablesToScope(variables, scope);
+
+ // Just keep the ones in false scope
+ variables = this.left.getPatternVariablesWhenFalse();
+ this.addPatternVariablesWhenFalse(variables);
+
+ this.right.collectPatternVariablesToScope(variables, scope);
+ variables = this.right.getPatternVariablesWhenFalse();
+ this.addPatternVariablesWhenFalse(variables);
+ // do this at the end, otherwise we will end up with
+ // same variable we just added from left to right
+ variables = this.left.getPatternVariablesWhenTrue();
+ this.right.addPatternVariablesWhenFalse(variables);
+
+ variables = this.left.getPatternVariablesWhenFalse();
+ this.right.addPatternVariablesWhenTrue(variables);
+ }
@Override
public boolean isCompactableOperation() {
return false;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java
index e9853b8412..b76b50c3fe 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java
@@ -21,7 +21,6 @@ import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
-@SuppressWarnings("rawtypes")
public class RecordComponent extends AbstractVariableDeclaration {
public RecordComponentBinding binding;
@@ -80,7 +79,7 @@ public class RecordComponent extends AbstractVariableDeclaration {
return RECORD_COMPONENT;
}
- public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
+ public void getAllAnnotationContexts(int targetType, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
this.traverse(collector, (BlockScope) null);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
index 5a054b5ff6..e1cc9a41f5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
@@ -1031,12 +1031,7 @@ public TypeBinding resolveType(BlockScope scope) {
if (scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8) // for 8, defer till effective finality could be ascertained.
scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)variable, this);
}
- if (this.actualReceiverType.isRecord() && this.actualReceiverType.isLocalType()) {// JLS 14 Sec 14.3
- if ((variable.modifiers & ClassFileConstants.AccStatic) == 0 &&
- (this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
- scope.problemReporter().recordStaticReferenceToOuterLocalVariable((LocalVariableBinding)variable, this);
- }
- }
+ checkLocalStaticClassVariables(scope, variable);
variableType = variable.type;
this.constant = (this.bits & ASTNode.IsStrictlyAssigned) == 0 ? variable.constant(scope) : Constant.NotAConstant;
} else {
@@ -1077,6 +1072,22 @@ public TypeBinding resolveType(BlockScope scope) {
return this.resolvedType = reportError(scope);
}
+private void checkLocalStaticClassVariables(BlockScope scope, VariableBinding variable) {
+ if (this.actualReceiverType.isStatic() && this.actualReceiverType.isLocalType()) {
+ if ((variable.modifiers & ClassFileConstants.AccStatic) == 0 &&
+ (this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
+ BlockScope declaringScope = ((LocalVariableBinding) this.binding).declaringScope;
+ MethodScope declaringMethodScope = declaringScope instanceof MethodScope ? (MethodScope)declaringScope :
+ declaringScope.enclosingMethodScope();
+ MethodScope currentMethodScope = scope instanceof MethodScope ? (MethodScope) scope : scope.enclosingMethodScope();
+ ClassScope declaringClassScope = declaringMethodScope != null ? declaringMethodScope.classScope() : null;
+ ClassScope currentClassScope = currentMethodScope != null ? currentMethodScope.classScope() : null;
+ if (declaringClassScope != currentClassScope)
+ scope.problemReporter().recordStaticReferenceToOuterLocalVariable((LocalVariableBinding)variable, this);
+ }
+ }
+}
+
@Override
public void traverse(ASTVisitor visitor, BlockScope scope) {
visitor.visit(this, scope);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
index fac3135ca3..be633b6dfc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -41,6 +41,8 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import java.util.function.Predicate;
+
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching.CheckMode;
@@ -85,7 +87,6 @@ public abstract class Statement extends ASTNode {
return false;
}
public abstract FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo);
-
/** Lambda shape analysis: *Assuming* this is reachable, analyze if this completes normally i.e control flow can reach the textually next statement.
For blocks, we don't perform intra-reachability analysis. We assume the lambda body is free of intrinsic control flow errors (if such errors
exist they will not be flagged by this analysis, but are guaranteed to surface later on.)
@@ -124,6 +125,8 @@ public boolean continueCompletes() {
public static final int NOT_COMPLAINED = 0;
public static final int COMPLAINED_FAKE_REACHABLE = 1;
public static final int COMPLAINED_UNREACHABLE = 2;
+ LocalVariableBinding[] patternVarsWhenTrue = null;
+ LocalVariableBinding[] patternVarsWhenFalse = null;
/** Analysing arguments of MessageSend, ExplicitConstructorCall, AllocationExpression. */
@@ -483,7 +486,65 @@ public StringBuffer print(int indent, StringBuffer output) {
public abstract StringBuffer printStatement(int indent, StringBuffer output);
public abstract void resolve(BlockScope scope);
-
+public LocalVariableBinding[] getPatternVariablesWhenTrue() {
+ return this.patternVarsWhenTrue;
+}
+public LocalVariableBinding[] getPatternVariablesWhenFalse() {
+ return this.patternVarsWhenFalse;
+}
+public void addPatternVariablesWhenTrue(LocalVariableBinding[] vars) {
+ this.patternVarsWhenTrue = addPatternVariables(this.patternVarsWhenTrue, vars);
+}
+public void addPatternVariablesWhenFalse(LocalVariableBinding[] vars) {
+ this.patternVarsWhenFalse = addPatternVariables(this.patternVarsWhenFalse, vars);
+}
+private LocalVariableBinding[] addPatternVariables(LocalVariableBinding[] current, LocalVariableBinding[] add) {
+ if (add == null || add.length == 0)
+ return current;
+ if (current == null) {
+ current = add;
+ } else {
+ for (LocalVariableBinding local : add) {
+ current = addPatternVariables(current, local);
+ }
+ }
+ return current;
+}
+private LocalVariableBinding[] addPatternVariables(LocalVariableBinding[] current, LocalVariableBinding add) {
+ int oldSize = current.length;
+ // it's odd that we only look at the last element, but in most cases
+ // we will only have one in the array. In the unlikely case of having two
+ // distinct pattern variables, the cost is nothing but setting the same
+ // bit twice on the same object.
+ if (oldSize > 0 && current[oldSize - 1] == add) {
+ return current;
+ }
+ int newLength = current.length + 1;
+ System.arraycopy(current, 0, (current = new LocalVariableBinding[newLength]), 0, oldSize);
+ current[oldSize] = add;
+ return current;
+}
+public void injectPatternVariablesIfApplicable(LocalVariableBinding[] patternVariablesInScope, BlockScope scope,
+ Predicate<Statement> condition) {
+ if (patternVariablesInScope != null && condition.test(this)) {
+ for (LocalVariableBinding binding : patternVariablesInScope) {
+ binding.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+ }
+ }
+}
+public void resolveWithPatternVariablesInScope(LocalVariableBinding[] patternVariablesInScope, BlockScope scope) {
+ if (patternVariablesInScope != null) {
+ for (LocalVariableBinding binding : patternVariablesInScope) {
+ binding.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+ }
+ this.resolve(scope);
+ for (LocalVariableBinding binding : patternVariablesInScope) {
+ binding.modifiers |= ExtraCompilerModifiers.AccUnresolved;
+ }
+ } else {
+ resolve(scope);
+ }
+}
/**
* Returns case constant associated to this statement (NotAConstant if none)
* parameter statement has to be either a SwitchStatement or a SwitchExpression
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index e6e22c8815..af9e1087a9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -72,7 +72,7 @@ public class TypeDeclaration extends Statement implements ProblemSeverities, Ref
public int maxFieldCount;
public int declarationSourceStart;
public int declarationSourceEnd;
- public int restrictedIdentifierStart; // used only for records
+ public int restrictedIdentifierStart = -1; // used only for record and permits restricted keywords.
public int bodyStart;
public int bodyEnd; // doesn't include the trailing comment if any.
public CompilationResult compilationResult;
@@ -91,8 +91,11 @@ public class TypeDeclaration extends Statement implements ProblemSeverities, Ref
// 14 Records preview support
public RecordComponent[] recordComponents;
public int nRecordComponents;
- public boolean isLocalRecord;
public static Set<String> disallowedComponentNames;
+
+ // 15 Sealed Type preview support
+ public TypeReference[] permittedTypes;
+
static {
disallowedComponentNames = new HashSet<>(6);
disallowedComponentNames.add("clone"); //$NON-NLS-1$
@@ -304,14 +307,6 @@ public void analyseCode(CompilationUnitScope unitScope) {
}
}
-public static void checkAndFlagRecordNameErrors(char[] typeName, ASTNode node, Scope skope) {
- if (CharOperation.equals(typeName, TypeConstants.RECORD_RESTRICTED_IDENTIFIER)) {
- if (skope.compilerOptions().sourceLevel == ClassFileConstants.JDK14) {
- skope.problemReporter().recordIsAReservedTypeName(node);
- }
- }
-}
-
/**
* Check for constructor vs. method with no return type.
* Answers true if at least one constructor is defined
@@ -367,9 +362,9 @@ public ConstructorDeclaration createDefaultConstructorForRecord(boolean needExpl
ConstructorDeclaration constructor = new ConstructorDeclaration(this.compilationResult);
constructor.bits |= ASTNode.IsCanonicalConstructor | ASTNode.IsImplicit;
constructor.selector = this.name;
-// constructor.modifiers = this.modifiers & ExtraCompilerModifiers.AccVisibilityMASK;
- constructor.modifiers = this.modifiers & ClassFileConstants.AccPublic;
- constructor.modifiers |= ClassFileConstants.AccPublic; // JLS 14 8.10.5
+ constructor.modifiers = this.modifiers & ExtraCompilerModifiers.AccVisibilityMASK;
+// constructor.modifiers = this.modifiers & ClassFileConstants.AccPublic;
+// constructor.modifiers |= ClassFileConstants.AccPublic; // JLS 14 8.10.5
constructor.arguments = getArgumentsFromComponents(this.recordComponents);
constructor.declarationSourceStart = constructor.sourceStart =
@@ -430,7 +425,7 @@ private Argument[] getArgumentsFromComponents(RecordComponent[] comps) {
int count = 0;
for (RecordComponent comp : comps) {
Argument argument = new Argument(comp.name, ((long)comp.sourceStart) << 32 | comp.sourceEnd,
- comp.type, comp.modifiers);
+ comp.type, 0); // no modifiers allowed for record components - enforce
args2[count++] = argument;
}
return args2;
@@ -1264,6 +1259,13 @@ public StringBuffer printHeader(int indent, StringBuffer output) {
this.superInterfaces[i].print(0, output);
}
}
+ if (this.permittedTypes != null && this.permittedTypes.length > 0) {
+ output.append(" permits "); //$NON-NLS-1$
+ for (int i = 0; i < this.permittedTypes.length; i++) {
+ if (i > 0) output.append( ", "); //$NON-NLS-1$
+ this.permittedTypes[i].print(0, output);
+ }
+ }
return output;
}
@@ -1294,7 +1296,7 @@ public void resolve() {
this.scope.problemReporter().varIsReservedTypeName(this);
}
}
- TypeDeclaration.checkAndFlagRecordNameErrors(this.name, this, this.scope);
+ this.scope.problemReporter().validateRestrictedKeywords(this.name, this);
// resolve annotations and check @Deprecated annotation
long annotationTagBits = sourceType.getAnnotationTagBits();
if ((annotationTagBits & TagBits.AnnotationDeprecated) == 0
@@ -1648,6 +1650,11 @@ public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope) {
for (int i = 0; i < length; i++)
this.superInterfaces[i].traverse(visitor, this.scope);
}
+ if (this.permittedTypes != null) {
+ int length = this.permittedTypes.length;
+ for (int i = 0; i < length; i++)
+ this.permittedTypes[i].traverse(visitor, this.scope);
+ }
if (this.typeParameters != null) {
int length = this.typeParameters.length;
for (int i = 0; i < length; i++) {
@@ -1709,6 +1716,11 @@ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
for (int i = 0; i < length; i++)
this.superInterfaces[i].traverse(visitor, this.scope);
}
+ if (this.permittedTypes != null) {
+ int length = this.permittedTypes.length;
+ for (int i = 0; i < length; i++)
+ this.permittedTypes[i].traverse(visitor, this.scope);
+ }
if (this.typeParameters != null) {
int length = this.typeParameters.length;
for (int i = 0; i < length; i++) {
@@ -1770,6 +1782,11 @@ public void traverse(ASTVisitor visitor, ClassScope classScope) {
for (int i = 0; i < length; i++)
this.superInterfaces[i].traverse(visitor, this.scope);
}
+ if (this.permittedTypes != null) {
+ int length = this.permittedTypes.length;
+ for (int i = 0; i < length; i++)
+ this.permittedTypes[i].traverse(visitor, this.scope);
+ }
if (this.typeParameters != null) {
int length = this.typeParameters.length;
for (int i = 0; i < length; i++) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
index d15b4c0f6c..8a75fd7d02 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -24,6 +24,7 @@ import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext;
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
@@ -37,7 +38,6 @@ import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
-@SuppressWarnings("rawtypes")
public class TypeParameter extends AbstractVariableDeclaration {
public TypeVariableBinding binding;
@@ -63,7 +63,7 @@ public class TypeParameter extends AbstractVariableDeclaration {
}
}
- public void getAllAnnotationContexts(int targetType, int typeParameterIndex, List allAnnotationContexts) {
+ public void getAllAnnotationContexts(int targetType, int typeParameterIndex, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, typeParameterIndex, allAnnotationContexts);
if (this.annotations != null) {
int annotationsLength = this.annotations.length;
@@ -120,7 +120,7 @@ public class TypeParameter extends AbstractVariableDeclaration {
scope.problemReporter().varIsNotAllowedHere(this);
}
}
- TypeDeclaration.checkAndFlagRecordNameErrors(this.name, this, scope);
+ scope.problemReporter().validateRestrictedKeywords(this.name, this);
}
@Override
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
index 3363eb9910..435597c06d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -69,7 +69,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
-@SuppressWarnings({"rawtypes", "unchecked"})
+@SuppressWarnings({})
public abstract class TypeReference extends Expression {
public static final TypeReference[] NO_TYPE_ARGUMENTS = new TypeReference[0];
@@ -91,7 +91,7 @@ public abstract class TypeReference extends Expression {
}
static class AnnotationCollector extends ASTVisitor {
- List annotationContexts;
+ List<AnnotationContext> annotationContexts;
Expression typeReference;
int targetType;
int info = 0;
@@ -106,7 +106,7 @@ static class AnnotationCollector extends ASTVisitor {
TypeParameter typeParameter,
int targetType,
int typeParameterIndex,
- List annotationContexts) {
+ List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = typeParameter.type;
this.targetType = targetType;
@@ -117,7 +117,7 @@ static class AnnotationCollector extends ASTVisitor {
LocalDeclaration localDeclaration,
int targetType,
LocalVariableBinding localVariable,
- List annotationContexts) {
+ List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = localDeclaration.type;
this.targetType = targetType;
@@ -128,7 +128,7 @@ static class AnnotationCollector extends ASTVisitor {
LocalDeclaration localDeclaration,
int targetType,
int parameterIndex,
- List annotationContexts) {
+ List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = localDeclaration.type;
this.targetType = targetType;
@@ -138,7 +138,7 @@ static class AnnotationCollector extends ASTVisitor {
public AnnotationCollector(
TypeReference typeReference,
int targetType,
- List annotationContexts) {
+ List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = typeReference;
this.targetType = targetType;
@@ -147,7 +147,7 @@ static class AnnotationCollector extends ASTVisitor {
Expression typeReference,
int targetType,
int info,
- List annotationContexts) {
+ List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = typeReference;
this.info = info;
@@ -158,7 +158,7 @@ static class AnnotationCollector extends ASTVisitor {
int targetType,
int info,
int typeIndex,
- List annotationContexts) {
+ List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = typeReference;
this.info = info;
@@ -169,7 +169,7 @@ static class AnnotationCollector extends ASTVisitor {
TypeReference typeReference,
int targetType,
int info,
- List annotationContexts,
+ List<AnnotationContext> annotationContexts,
Annotation[][] annotationsOnDimensions,
int dimensions) {
this.annotationContexts = annotationContexts;
@@ -185,7 +185,7 @@ static class AnnotationCollector extends ASTVisitor {
this.dimensions = dimensions;
}
- public AnnotationCollector(RecordComponent recordComponent, int targetType, List annotationContexts) {
+ public AnnotationCollector(RecordComponent recordComponent, int targetType, List<AnnotationContext> annotationContexts) {
this.annotationContexts = annotationContexts;
this.typeReference = recordComponent.type;
this.targetType = targetType;
@@ -425,10 +425,10 @@ public int extraDimensions() {
}
public AnnotationContext[] getAllAnnotationContexts(int targetType) {
- List allAnnotationContexts = new ArrayList();
+ List<AnnotationContext> allAnnotationContexts = new ArrayList<>();
AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
this.traverse(collector, (BlockScope) null);
- return (AnnotationContext[]) allAnnotationContexts.toArray(new AnnotationContext[allAnnotationContexts.size()]);
+ return allAnnotationContexts.toArray(new AnnotationContext[allAnnotationContexts.size()]);
}
/**
* info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
@@ -436,11 +436,11 @@ public AnnotationContext[] getAllAnnotationContexts(int targetType) {
* @param info
* @param allAnnotationContexts
*/
-public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts) {
+public void getAllAnnotationContexts(int targetType, int info, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts);
this.traverse(collector, (BlockScope) null);
}
-public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts, Annotation [] se7Annotations) {
+public void getAllAnnotationContexts(int targetType, int info, List<AnnotationContext> allAnnotationContexts, Annotation [] se7Annotations) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts);
for (int i = 0, length = se7Annotations == null ? 0 : se7Annotations.length; i < length; i++) {
Annotation annotation = se7Annotations[i];
@@ -451,7 +451,7 @@ public void getAllAnnotationContexts(int targetType, int info, List allAnnotatio
/**
* info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
*/
-public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts, Annotation[][] annotationsOnDimensions, int dimensions) {
+public void getAllAnnotationContexts(int targetType, int info, List<AnnotationContext> allAnnotationContexts, Annotation[][] annotationsOnDimensions, int dimensions) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts, annotationsOnDimensions, dimensions);
this.traverse(collector, (BlockScope) null);
if (annotationsOnDimensions != null) {
@@ -465,11 +465,11 @@ public void getAllAnnotationContexts(int targetType, int info, List allAnnotatio
}
}
}
-public void getAllAnnotationContexts(int targetType, int info, int typeIndex, List allAnnotationContexts) {
+public void getAllAnnotationContexts(int targetType, int info, int typeIndex, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, typeIndex, allAnnotationContexts);
this.traverse(collector, (BlockScope) null);
}
-public void getAllAnnotationContexts(int targetType, List allAnnotationContexts) {
+public void getAllAnnotationContexts(int targetType, List<AnnotationContext> allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, allAnnotationContexts);
this.traverse(collector, (BlockScope) null);
}
@@ -532,17 +532,16 @@ protected TypeBinding internalResolveType(Scope scope, int location) {
}
}
}
- boolean hasError;
+ boolean hasError = false;
TypeBinding type = this.resolvedType = getTypeBinding(scope);
if (type == null) {
return null; // detected cycle while resolving hierarchy
} else if ((hasError = !type.isValidBinding()) == true) {
if (this.isTypeNameVar(scope)) {
reportVarIsNotAllowedHere(scope);
- } else {
+ } else if (!scope.problemReporter().validateRestrictedKeywords(getLastToken(), this)) {
reportInvalidType(scope);
}
- TypeDeclaration.checkAndFlagRecordNameErrors(getTypeName(0), this, scope);
switch (type.problemId()) {
case ProblemReasons.NotFound :
case ProblemReasons.NotVisible :
@@ -553,6 +552,8 @@ protected TypeBinding internalResolveType(Scope scope, int location) {
default :
return null;
}
+ } else { // check anyway - to cover a illegally declared "permits" type
+ scope.problemReporter().validateRestrictedKeywords(getLastToken(), this);
}
if (type.isArrayType() && ((ArrayBinding) type).leafComponentType == TypeBinding.VOID) {
scope.problemReporter().cannotAllocateVoidArray(this);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
index c43e55c983..9037694a11 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
@@ -224,7 +224,22 @@ public class UnaryExpression extends OperatorExpression {
output.append(operatorToString()).append(' ');
return this.expression.printExpression(0, output);
}
+ @Override
+ public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.expression.collectPatternVariablesToScope(variables, scope);
+ if (((this.bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
+ variables = this.expression.getPatternVariablesWhenTrue();
+ this.addPatternVariablesWhenFalse(variables);
+ variables = this.expression.getPatternVariablesWhenFalse();
+ this.addPatternVariablesWhenTrue(variables);
+ } else {
+ variables = this.expression.getPatternVariablesWhenTrue();
+ this.addPatternVariablesWhenTrue(variables);
+ variables = this.expression.getPatternVariablesWhenFalse();
+ this.addPatternVariablesWhenFalse(variables);
+ }
+ }
@Override
public TypeBinding resolveType(BlockScope scope) {
boolean expressionIsCast;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
index a02b59d849..958887b700 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
@@ -275,10 +275,25 @@ public class WhileStatement extends Statement {
@Override
public void resolve(BlockScope scope) {
- TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
- this.condition.computeConversion(scope, type, type);
- if (this.action != null)
- this.action.resolve(scope);
+ if (this.condition.containsPatternVariable()) {
+ this.condition.collectPatternVariablesToScope(null, scope);
+ LocalVariableBinding[] patternVariablesInTrueScope = this.condition.getPatternVariablesWhenTrue();
+ LocalVariableBinding[] patternVariablesInFalseScope = this.condition.getPatternVariablesWhenFalse();
+
+ TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
+ this.condition.computeConversion(scope, type, type);
+ if (this.action != null) {
+ this.action.resolveWithPatternVariablesInScope(patternVariablesInTrueScope, scope);
+ this.action.injectPatternVariablesIfApplicable(patternVariablesInFalseScope, scope,
+ (statement) -> { return !statement.breaksOut(null);});
+ }
+ } else {
+ TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN);
+ this.condition.computeConversion(scope, type, type);
+ if (this.action != null)
+ this.action.resolve(scope);
+ }
+
}
@Override
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
index 9cdfe85d0a..536aaae96c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -131,9 +131,10 @@ public interface ClassFileConstants {
int MAJOR_VERSION_12 = 56;
int MAJOR_VERSION_13 = 57;
int MAJOR_VERSION_14 = 58;
+ int MAJOR_VERSION_15 = 59;
int MAJOR_VERSION_0 = 44;
- int MAJOR_LATEST_VERSION = MAJOR_VERSION_14;
+ int MAJOR_LATEST_VERSION = MAJOR_VERSION_15;
int MINOR_VERSION_0 = 0;
int MINOR_VERSION_1 = 1;
@@ -158,6 +159,7 @@ public interface ClassFileConstants {
long JDK12 = ((long)ClassFileConstants.MAJOR_VERSION_12 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK13 = ((long)ClassFileConstants.MAJOR_VERSION_13 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK14 = ((long)ClassFileConstants.MAJOR_VERSION_14 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK15 = ((long)ClassFileConstants.MAJOR_VERSION_15 << 16) + ClassFileConstants.MINOR_VERSION_0;
public static long getLatestJDKLevel() {
return ((long)ClassFileConstants.MAJOR_LATEST_VERSION << 16) + ClassFileConstants.MINOR_VERSION_0;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
index c34c9db424..66d99ac551 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -37,6 +37,7 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
import org.eclipse.jdt.internal.compiler.env.IModule;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker;
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus;
@@ -67,6 +68,8 @@ public class ClassFileReader extends ClassFileStruct implements IBinaryType {
private InnerClassInfo[] innerInfos;
private char[][] interfaceNames;
private int interfacesCount;
+ private char[][] permittedSubtypesNames;
+ private int permittedSubtypesCount;
private MethodInfo[] methods;
private int methodsCount;
private char[] signature;
@@ -84,7 +87,7 @@ public class ClassFileReader extends ClassFileStruct implements IBinaryType {
private char[][] nestMembers;
private boolean isRecord;
private int recordComponentsCount;
- private ComponentInfo[] recordComponents;
+ private RecordComponentInfo[] recordComponents;
private static String printTypeModifiers(int modifiers) {
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
@@ -96,6 +99,7 @@ private static String printTypeModifiers(int modifiers) {
if ((modifiers & ClassFileConstants.AccSuper) != 0) print.print("super "); //$NON-NLS-1$
if ((modifiers & ClassFileConstants.AccInterface) != 0) print.print("interface "); //$NON-NLS-1$
if ((modifiers & ClassFileConstants.AccAbstract) != 0) print.print("abstract "); //$NON-NLS-1$
+ if ((modifiers & ExtraCompilerModifiers.AccSealed) != 0) print.print("sealed "); //$NON-NLS-1$
print.flush();
return out.toString();
}
@@ -470,6 +474,23 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit
}
}
break;
+ case 'P' :
+ if (CharOperation.equals(attributeName, AttributeNamesConstants.PermittedSubclasses)) {
+ int offset = readOffset + 6;
+ this.permittedSubtypesCount = u2At(offset);
+ if (this.permittedSubtypesCount != 0) {
+ this.accessFlags |= ExtraCompilerModifiers.AccSealed;
+ offset += 2;
+ this.permittedSubtypesNames = new char[this.permittedSubtypesCount][];
+ for (int j = 0; j < this.permittedSubtypesCount; j++) {
+ utf8Offset =
+ this.constantPoolOffsets[u2At(this.constantPoolOffsets[u2At(offset)] + 1)];
+ this.permittedSubtypesNames[j] = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ offset += 2;
+ }
+ }
+ }
+ break;
}
readOffset += (6 + u4At(readOffset + 2));
}
@@ -497,9 +518,9 @@ private void decodeRecords(int readOffset, char[] attributeName) {
this.recordComponentsCount = u2At(offset);
if (this.recordComponentsCount != 0) {
offset += 2;
- this.recordComponents = new ComponentInfo[this.recordComponentsCount];
+ this.recordComponents = new RecordComponentInfo[this.recordComponentsCount];
for (int j = 0; j < this.recordComponentsCount; j++) {
- ComponentInfo component = ComponentInfo.createComponent(this.reference, this.constantPoolOffsets, offset, this.version);
+ RecordComponentInfo component = RecordComponentInfo.createComponent(this.reference, this.constantPoolOffsets, offset, this.version);
this.recordComponents[j] = component;
offset += component.sizeInBytes();
}
@@ -733,6 +754,11 @@ public char[][] getInterfaceNames() {
}
@Override
+public char[][] getPermittedSubtypeNames() {
+ return this.permittedSubtypesNames;
+}
+
+@Override
public IBinaryNestedType[] getMemberTypes() {
// we might have some member types of the current type
if (this.innerInfos == null) return null;
@@ -858,6 +884,8 @@ public int getModifiers() {
} else {
modifiers = this.accessFlags;
}
+ if (this.permittedSubtypesCount > 0)
+ modifiers |= ExtraCompilerModifiers.AccSealed;
return modifiers;
}
@@ -1039,6 +1067,17 @@ public boolean hasStructuralChanges(byte[] newBytes, boolean orderRequired, bool
return true;
}
+ // permitted sub-types
+ char[][] newPermittedSubtypeNames = newClassFile.getPermittedSubtypeNames();
+ if (this.permittedSubtypesNames != newPermittedSubtypeNames) {
+ int newPermittedSubtypesLength = newPermittedSubtypeNames == null ? 0 : newPermittedSubtypeNames.length;
+ if (newPermittedSubtypesLength != this.permittedSubtypesCount)
+ return true;
+ for (int i = 0, max = this.permittedSubtypesCount; i < max; i++)
+ if (!CharOperation.equals(this.permittedSubtypesNames[i], newPermittedSubtypeNames[i]))
+ return true;
+ }
+
// member types
IBinaryNestedType[] currentMemberTypes = getMemberTypes();
IBinaryNestedType[] otherMemberTypes = newClassFile.getMemberTypes();
@@ -1412,7 +1451,13 @@ public String toString() {
return out.toString();
}
+@Override
public boolean isRecord() {
return this.isRecord;
}
+
+@Override
+public IRecordComponent[] getRecordComponents() {
+ return this.recordComponents;
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java
index 29414f4c2e..0ca00b6d14 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 IBM Corporation and others.
+ * Copyright (c) 2019, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,10 +12,10 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.classfmt;
-public class ComponentInfoWithAnnotation extends ComponentInfo {
+public class ComponentInfoWithAnnotation extends RecordComponentInfo {
private AnnotationInfo[] annotations;
- ComponentInfoWithAnnotation(ComponentInfo info, AnnotationInfo[] annos) {
+ ComponentInfoWithAnnotation(RecordComponentInfo info, AnnotationInfo[] annos) {
super(info.reference, info.constantPoolOffsets, info.structOffset, info.version);
this.attributeBytes = info.attributeBytes;
this.constantPoolOffsets = info.constantPoolOffsets;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java
index 73441a89c0..18b5b22f73 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java
@@ -17,7 +17,7 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
public final class ComponentInfoWithTypeAnnotation extends ComponentInfoWithAnnotation {
private TypeAnnotationInfo[] typeAnnotations;
-ComponentInfoWithTypeAnnotation(ComponentInfo info, AnnotationInfo[] annos, TypeAnnotationInfo[] typeAnnos) {
+ComponentInfoWithTypeAnnotation(RecordComponentInfo info, AnnotationInfo[] annos, TypeAnnotationInfo[] typeAnnos) {
super(info, annos);
this.typeAnnotations = typeAnnos;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java
index afcef9d875..1f4318a48a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2017 Google, Inc. and others.
+ * Copyright (c) 2016, 2020 Google, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -27,6 +27,7 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
@@ -96,6 +97,11 @@ public class ExternalAnnotationDecorator implements IBinaryType {
}
@Override
+ public IRecordComponent[] getRecordComponents() {
+ return this.inputType.getRecordComponents();
+ }
+
+ @Override
public char[] getGenericSignature() {
return this.inputType.getGenericSignature();
}
@@ -149,6 +155,10 @@ public class ExternalAnnotationDecorator implements IBinaryType {
public boolean isLocal() {
return this.inputType.isLocal();
}
+ @Override
+ public boolean isRecord() {
+ return this.inputType.isRecord();
+ }
@Override
public boolean isMember() {
@@ -298,4 +308,5 @@ public class ExternalAnnotationDecorator implements IBinaryType {
}
return ExternalAnnotationStatus.TYPE_IS_ANNOTATED;
}
+
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/RecordComponentInfo.java
index f357ad2dc6..b15c6aeab9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/RecordComponentInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 IBM Corporation and others.
+ * Copyright (c) 2019, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -17,7 +17,8 @@ import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
-import org.eclipse.jdt.internal.compiler.env.IComponent;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
+import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
/*
@@ -26,7 +27,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TagBits;
* it is too early to disturb the field_info code. To be done if this gets standardized.
*/
@SuppressWarnings("rawtypes")
-public class ComponentInfo extends ClassFileStruct implements IComponent, Comparable {
+public class RecordComponentInfo extends ClassFileStruct implements IRecordComponent, Comparable {
protected int attributeBytes;
protected char[] descriptor;
protected char[] name;
@@ -35,8 +36,8 @@ public class ComponentInfo extends ClassFileStruct implements IComponent, Compar
protected long tagBits;
protected long version;
-public static ComponentInfo createComponent(byte classFileBytes[], int offsets[], int offset, long version) {
- ComponentInfo componentInfo = new ComponentInfo(classFileBytes, offsets, offset, version);
+public static RecordComponentInfo createComponent(byte classFileBytes[], int offsets[], int offset, long version) {
+ RecordComponentInfo componentInfo = new RecordComponentInfo(classFileBytes, offsets, offset, version);
int attributesCount = componentInfo.u2At(4);
int readOffset = 6;
@@ -104,7 +105,7 @@ public static ComponentInfo createComponent(byte classFileBytes[], int offsets[]
* @param offset int
* @param version class file version
*/
-protected ComponentInfo (byte classFileBytes[], int offsets[], int offset, long version) {
+protected RecordComponentInfo (byte classFileBytes[], int offsets[], int offset, long version) {
super(classFileBytes, offsets, offset);
this.signatureUtf8Offset = -1;
this.version = version;
@@ -156,14 +157,14 @@ TypeAnnotationInfo[] decodeTypeAnnotations(int offset, boolean runtimeVisible) {
@Override
public int compareTo(Object o) {
- return new String(getName()).compareTo(new String(((ComponentInfo) o).getName()));
+ return new String(getName()).compareTo(new String(((RecordComponentInfo) o).getName()));
}
@Override
public boolean equals(Object o) {
- if (!(o instanceof ComponentInfo)) {
+ if (!(o instanceof RecordComponentInfo)) {
return false;
}
- return CharOperation.equals(getName(), ((ComponentInfo) o).getName());
+ return CharOperation.equals(getName(), ((RecordComponentInfo) o).getName());
}
@Override
public int hashCode() {
@@ -266,4 +267,16 @@ protected void toStringContent(StringBuffer buffer) {
.append('}')
.toString();
}
+
+@Override
+public Constant getConstant() {
+ // Doesn't really apply to a record component.
+ return null;
+}
+
+@Override
+public int getModifiers() {
+ // Doesn't really apply to a record component.
+ return 0;
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
index b069105dcf..9adffd1801 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -55,4 +55,5 @@ public interface AttributeNamesConstants {
final char[] NestMembers = "NestMembers".toCharArray(); //$NON-NLS-1$
// jep 359 records
final char[] RecordClass = "Record".toCharArray(); //$NON-NLS-1$
+ final char[] PermittedSubclasses = "PermittedSubclasses".toCharArray(); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java
index 447651540a..30722b013b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2015 IBM Corporation and others.
+ * Copyright (c) 2012, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -30,14 +30,13 @@ import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
-@SuppressWarnings({"rawtypes"})
public class TypeAnnotationCodeStream extends StackMapFrameCodeStream {
- public List allTypeAnnotationContexts;
+ public List<AnnotationContext> allTypeAnnotationContexts;
public TypeAnnotationCodeStream(ClassFile givenClassFile) {
super(givenClassFile);
this.generateAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
- this.allTypeAnnotationContexts = new ArrayList();
+ this.allTypeAnnotationContexts = new ArrayList<>();
}
private void addAnnotationContext(TypeReference typeReference, int info, int targetType, ArrayAllocationExpression allocationExpression) {
@@ -162,12 +161,12 @@ public class TypeAnnotationCodeStream extends StackMapFrameCodeStream {
@Override
public void reset(ClassFile givenClassFile) {
super.reset(givenClassFile);
- this.allTypeAnnotationContexts = new ArrayList();
+ this.allTypeAnnotationContexts = new ArrayList<>();
}
@Override
public void init(ClassFile targetClassFile) {
super.init(targetClassFile);
- this.allTypeAnnotationContexts = new ArrayList();
+ this.allTypeAnnotationContexts = new ArrayList<>();
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
index c3f8b8c779..87b2eafdf0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -62,6 +62,11 @@ char[] getEnclosingTypeName();
IBinaryField[] getFields();
/**
+ * Answer the receiver's record components or null if the array is empty.
+ */
+
+IRecordComponent[] getRecordComponents();
+/**
* Answer the module to which this type belongs.
* {@code null} if the type is associated to the unnamed module.
*
@@ -86,6 +91,18 @@ char[] getGenericSignature();
*/
char[][] getInterfaceNames();
+
+/**
+ * Answer the unresolved names of the receiver's permitted sub types
+ * or null if the array is empty.
+ *
+ * A name is a simple name or a qualified, dot separated name.
+ * For example, Hashtable or java.util.Hashtable.
+ */
+default char[][] getPermittedSubtypeNames() {
+ return null;
+}
+
/**
* Answer the receiver's nested types or null if the array is empty.
*
@@ -150,6 +167,12 @@ boolean isAnonymous();
boolean isLocal();
/**
+ * Answer true if the receiver is a record.
+ * false otherwise
+ */
+boolean isRecord();
+
+/**
* Answer true if the receiver is a member class.
* false otherwise
*/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IComponent.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IComponent.java
deleted file mode 100644
index c3f6f09243..0000000000
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IComponent.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2019 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.compiler.env;
-
-public interface IComponent {
-/**
- * Answer the runtime visible and invisible annotations for this component or null if none.
- */
-IBinaryAnnotation[] getAnnotations();
-
-/**
- * Answer the runtime visible and invisible type annotations for this component or null if none.
- */
-IBinaryTypeAnnotation[] getTypeAnnotations();
-
-/**
- * Answer the receiver's componentSignature, which describes the component's type
- * as specified in "4.7.9.1 Signatures" of the Java SE 8 VM spec.
- */
-char[] getGenericSignature();
-
-/**
- * Answer the name of the component.
- */
-char[] getName();
-
-/**
- * Answer the tagbits set according to the bits for annotations.
- */
-long getTagBits();
-
-/**
- * Answer the resolved name of the receiver's type in the
- * class file format as specified in section 4.3.2 of the Java 2 VM spec.
- *
- * For example:
- * - java.lang.String is Ljava/lang/String;
- * - an int is I
- * - a 2 dimensional array of strings is [[Ljava/lang/String;
- * - an array of floats is [F
- */
-char[] getTypeName();
-}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IRecordComponent.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IRecordComponent.java
new file mode 100644
index 0000000000..276e4a61f1
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IRecordComponent.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2019, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.env;
+
+public interface IRecordComponent extends IBinaryField {
+ // Nothing new here
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
index a032122191..c53e6ba811 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -48,6 +48,17 @@ ISourceField[] getFields();
char[][] getInterfaceNames();
/**
+ * Answer the unresolved names of the receiver's permitted sub types
+ * or null if the array is empty.
+ *
+ * A name is a simple name or a qualified, dot separated name.
+ * For example, Hashtable or java.util.Hashtable.
+ */
+default char[][] getPermittedSubtypeNames() {
+ return null;
+}
+
+/**
* Answer the receiver's member types.
*/
ISourceType[] getMemberTypes();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index afb8d27a32..5f6a5d21b1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -234,6 +234,7 @@ public class CompilerOptions {
public static final String VERSION_12 = "12"; //$NON-NLS-1$
public static final String VERSION_13 = "13"; //$NON-NLS-1$
public static final String VERSION_14 = "14"; //$NON-NLS-1$
+ public static final String VERSION_15 = "15"; //$NON-NLS-1$
/*
* Note: Whenever a new version is added, make sure getLatestVersion()
* is updated with it.
@@ -604,7 +605,7 @@ public class CompilerOptions {
* Return the latest Java language version supported by the Eclipse compiler
*/
public static String getLatestVersion() {
- return VERSION_14;
+ return VERSION_15;
}
/**
* Return the most specific option key controlling this irritant. Note that in some case, some irritant is controlled by
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
new file mode 100644
index 0000000000..813c3b75aa
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.impl;
+
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
+import org.eclipse.jdt.internal.compiler.util.Messages;
+
+/**
+ * An internal enumeration of all Java language features that were introduced as
+ * standard feature or preview feature from Java 15. The idea is to have one
+ * location where the applicability of a feature, such as version supported in,
+ * whether or not a preview, what are the restricted keywords introduced by a
+ * feature etc. This is expected to be updated every time there's a new Java
+ * version and the change is expected to be one of the following kinds:
+ * <ul>
+ * <li>The preview feature continues to be a preview in the next version</li>
+ * <li>The preview feature is upgraded to a standard feature</li>
+ * <li>The preview feature is removed</li>
+ * </ul>
+ *
+ * @author jay
+ */
+public enum JavaFeature {
+
+ TEXT_BLOCKS(ClassFileConstants.JDK15,
+ Messages.bind(Messages.text_block),
+ new char[][] {},
+ false),
+
+ PATTERN_MATCHING_IN_INSTANCEOF(ClassFileConstants.JDK15,
+ Messages.bind(Messages.pattern_matching_instanceof),
+ new char[][] {},
+ true),
+
+ RECORDS(ClassFileConstants.JDK15,
+ Messages.bind(Messages.records),
+ new char[][] {TypeConstants.RECORD_RESTRICTED_IDENTIFIER},
+ true),
+
+ SEALED_CLASSES(ClassFileConstants.JDK15,
+ Messages.bind(Messages.sealed_types),
+ new char[][] {TypeConstants.SEALED, TypeConstants.PERMITS},
+ true),
+ ;
+
+ final long compliance;
+ final String name;
+ final boolean isPreview;
+ char[][] restrictedKeywords;
+
+ public boolean isPreview() {
+ return this.isPreview;
+ }
+ public String getName() {
+ return this.name;
+ }
+ public long getCompliance() {
+ return this.compliance;
+ }
+ public char[][] getRestrictedKeywords() {
+ return this.restrictedKeywords;
+ }
+ public boolean isSupported(CompilerOptions options) {
+ if (this.isPreview)
+ return options.enablePreviewFeatures;
+ return this.getCompliance() <= options.sourceLevel;
+ }
+ public boolean isSupported(long comp, boolean preview) {
+ if (this.isPreview)
+ return preview;
+ return this.getCompliance() <= comp;
+ }
+
+ JavaFeature(long compliance, String name, char[][] restrictedKeywords, boolean isPreview) {
+ this.compliance = compliance;
+ this.name = name;
+ this.isPreview = isPreview;
+ this.restrictedKeywords = restrictedKeywords;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index 593832352a..f44a6c60e5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -97,6 +97,7 @@ public class BinaryTypeBinding extends ReferenceBinding {
protected ReferenceBinding superclass;
protected ReferenceBinding enclosingType;
protected ReferenceBinding[] superInterfaces;
+ protected ReferenceBinding[] permittedSubtypes;
protected FieldBinding[] fields;
protected MethodBinding[] methods;
protected ReferenceBinding[] memberTypes;
@@ -261,6 +262,7 @@ public BinaryTypeBinding(BinaryTypeBinding prototype) {
this.superclass = prototype.superclass;
this.enclosingType = prototype.enclosingType;
this.superInterfaces = prototype.superInterfaces;
+ this.permittedSubtypes = prototype.permittedSubtypes;
this.fields = prototype.fields;
this.methods = prototype.methods;
this.memberTypes = prototype.memberTypes;
@@ -442,6 +444,7 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
// and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748).
this.typeVariables = Binding.NO_TYPE_VARIABLES;
this.superInterfaces = Binding.NO_SUPERINTERFACES;
+ this.permittedSubtypes = Binding.NO_PERMITTEDTYPES;
// must retrieve member types in case superclass/interfaces need them
this.memberTypes = Binding.NO_MEMBER_TYPES;
@@ -526,6 +529,20 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
this.tagBits |= TagBits.HasUnresolvedSuperinterfaces;
}
}
+
+ this.permittedSubtypes = Binding.NO_PERMITTEDTYPES;
+ char[][] permittedSubtypeNames = binaryType.getPermittedSubtypeNames();
+ if (permittedSubtypeNames != null) {
+ this.modifiers |= ExtraCompilerModifiers.AccSealed;
+ int size = permittedSubtypeNames.length;
+ if (size > 0) {
+ this.permittedSubtypes = new ReferenceBinding[size];
+ for (short i = 0; i < size; i++)
+ // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
+ this.permittedSubtypes[i] = this.environment.getTypeFromConstantPoolName(permittedSubtypeNames[i], 0, -1, false, missingTypeNames, toplevelWalker.toSupertype(i, superclassName));
+ this.extendedTagBits |= ExtendedTagBits.HasUnresolvedPermittedSubtypes;
+ }
+ }
} else {
// attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
this.superclass = (ReferenceBinding) this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames,
@@ -544,6 +561,20 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
types.toArray(this.superInterfaces);
this.tagBits |= TagBits.HasUnresolvedSuperinterfaces;
}
+
+ this.permittedSubtypes = Binding.NO_PERMITTEDTYPES;
+ if (!wrapper.atEnd()) {
+ // attempt to find each permitted type if it exists in the cache (otherwise - resolve it when requested)
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ short rank = 0;
+ do {
+ types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames, toplevelWalker.toSupertype(rank++, wrapper.peekFullType())));
+ } while (!wrapper.atEnd());
+ this.permittedSubtypes = new ReferenceBinding[types.size()];
+ types.toArray(this.permittedSubtypes);
+ this.extendedTagBits |= ExtendedTagBits.HasUnresolvedPermittedSubtypes;
+ }
+
}
boolean canUseNullTypeAnnotations = this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled && this.environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_8;
if (canUseNullTypeAnnotations && this.externalAnnotationStatus.isPotentiallyUnannotatedLib()) {
@@ -556,6 +587,12 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
break;
}
}
+ for (TypeBinding permsub : this.permittedSubtypes) {
+ if (permsub.hasNullTypeAnnotations()) {
+ this.externalAnnotationStatus = ExternalAnnotationStatus.TYPE_IS_ANNOTATED;
+ break;
+ }
+ }
}
}
@@ -1267,6 +1304,7 @@ public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes
refScope.recordTypeReference(this.superclass);
return this.superclass.getExactMethod(selector, argumentTypes, refScope);
}
+ // NOTE: not adding permitted types here since the search is up the hierarchy while permitted ones are down.
}
return null;
}
@@ -2200,6 +2238,18 @@ public ReferenceBinding[] superInterfaces() {
return this.superInterfaces;
}
@Override
+public ReferenceBinding[] permittedTypes() {
+
+ if (!isPrototype()) {
+ return this.permittedSubtypes = this.prototype.permittedTypes();
+ }
+ for (int i = this.permittedSubtypes.length; --i >= 0;)
+ this.permittedSubtypes[i] = (ReferenceBinding) resolveType(this.permittedSubtypes[i], this.environment, false);
+
+ // Note: unlike for superinterfaces() hierarchy check not required here since these are subtypes
+ return this.permittedSubtypes;
+}
+@Override
public TypeVariableBinding[] typeVariables() {
if (!isPrototype()) {
@@ -2267,6 +2317,19 @@ public String toString() {
buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
}
+ if (this.permittedSubtypes != null) {
+ if (this.permittedSubtypes != Binding.NO_PERMITTEDTYPES) {
+ buffer.append("\n\tpermits : "); //$NON-NLS-1$
+ for (int i = 0, length = this.permittedSubtypes.length; i < length; i++) {
+ if (i > 0)
+ buffer.append(", "); //$NON-NLS-1$
+ buffer.append((this.permittedSubtypes[i] != null) ? this.permittedSubtypes[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
+ }
+ }
+ } else {
+ buffer.append("NULL PERMITTEDSUBTYPES"); //$NON-NLS-1$
+ }
+
if (this.enclosingType != null) {
buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
buffer.append(this.enclosingType.debugName());
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
index e59aca9a59..be075cc361 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
@@ -61,6 +61,7 @@ public abstract class Binding {
public static final ReferenceBinding[] ANY_EXCEPTION = new ReferenceBinding[] { null }; // special handler for all exceptions
public static final FieldBinding[] NO_FIELDS = new FieldBinding[0];
public static final MethodBinding[] NO_METHODS = new MethodBinding[0];
+ public static final ReferenceBinding[] NO_PERMITTEDTYPES = new ReferenceBinding[0];
public static final ReferenceBinding[] NO_SUPERINTERFACES = new ReferenceBinding[0];
public static final ReferenceBinding[] NO_MEMBER_TYPES = new ReferenceBinding[0];
public static final TypeVariableBinding[] NO_TYPE_VARIABLES = new TypeVariableBinding[0];
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
index 34b0fc31f1..a5b92f16c8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
@@ -477,9 +477,19 @@ public LocalDeclaration[] findLocalVariableDeclarations(int position) {
}
return null;
}
-
+private boolean isPatternVariableInScope(InvocationSite invocationSite, LocalVariableBinding variable) {
+ LocalVariableBinding[] patternVariablesInScope = invocationSite.getPatternVariablesWhenTrue();
+ if (patternVariablesInScope == null)
+ return false;
+ for (LocalVariableBinding v : patternVariablesInScope) {
+ if (v == variable) {
+ return true;
+ }
+ }
+ return false;
+}
@Override
-public LocalVariableBinding findVariable(char[] variableName) {
+public LocalVariableBinding findVariable(char[] variableName, InvocationSite invocationSite) {
int varLength = variableName.length;
for (int i = this.localIndex-1; i >= 0; i--) { // lookup backward to reach latest additions first
LocalVariableBinding local = this.locals[i];
@@ -495,8 +505,14 @@ public LocalVariableBinding findVariable(char[] variableName) {
if ((local.modifiers & ExtraCompilerModifiers.AccPatternVariable) == 0)
continue;
char[] localName;
- if ((localName = local.name).length == varLength && CharOperation.equals(localName, variableName))
+ if ((localName = local.name).length != varLength || !CharOperation.equals(localName, variableName))
+ continue;
+ if ((local.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0) {
return local;
+ }
+ if (isPatternVariableInScope(invocationSite, local)) {
+ return local;
+ }
}
return null;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index 9031bf0790..72a1921d91 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -35,7 +35,11 @@ package org.eclipse.jdt.internal.compiler.lookup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
+
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
@@ -82,6 +86,7 @@ public class ClassScope extends Scope {
}
}
anonymousType.typeBits |= inheritedBits;
+ anonymousType.setPermittedTypes(Binding.NO_PERMITTEDTYPES); // JLS 15 JEP 360 Preview - Sec 15.9.5
if (supertype.isInterface()) {
anonymousType.setSuperClass(getJavaLangObject());
anonymousType.setSuperInterfaces(new ReferenceBinding[] { supertype });
@@ -97,6 +102,7 @@ public class ClassScope extends Scope {
} else {
anonymousType.setSuperClass(supertype);
anonymousType.setSuperInterfaces(Binding.NO_SUPERINTERFACES);
+ checkForEnumSealedPreview(supertype, anonymousType);
TypeReference typeReference = this.referenceContext.allocation.type;
if (typeReference != null) { // no check for enum constant body
this.referenceContext.superclass = typeReference;
@@ -118,6 +124,10 @@ public class ClassScope extends Scope {
problemReporter().superTypeCannotUseWildcard(anonymousType, typeReference, supertype);
anonymousType.tagBits |= TagBits.HierarchyHasProblems;
anonymousType.setSuperClass(getJavaLangObject());
+ } else if (supertype.isSealed()) {
+ problemReporter().sealedAnonymousClassCannotExtendSealedType(typeReference, supertype);
+ anonymousType.tagBits |= TagBits.HierarchyHasProblems;
+ anonymousType.setSuperClass(getJavaLangObject());
}
}
}
@@ -127,6 +137,27 @@ public class ClassScope extends Scope {
anonymousType.verifyMethods(environment().methodVerifier());
}
+ private void checkForEnumSealedPreview(ReferenceBinding supertype, LocalTypeBinding anonymousType) {
+ if (compilerOptions().sourceLevel < ClassFileConstants.JDK15
+ || !compilerOptions().enablePreviewFeatures
+ || !supertype.isEnum()
+ || !(supertype instanceof SourceTypeBinding))
+ return;
+
+ SourceTypeBinding sourceSuperType = (SourceTypeBinding) supertype;
+ ReferenceBinding[] permTypes = sourceSuperType.permittedTypes();
+ int sz = permTypes == null ? 0 : permTypes.length;
+ if (sz == 0) {
+ permTypes = new ReferenceBinding[] {anonymousType};
+ } else {
+ System.arraycopy(permTypes, 0,
+ permTypes = new ReferenceBinding[sz + 1], 0,
+ sz);
+ permTypes[sz] = anonymousType;
+ }
+ sourceSuperType.setPermittedTypes(permTypes);
+ }
+
void buildComponents() {
SourceTypeBinding sourceType = this.referenceContext.binding;
if (!sourceType.isRecord()) return;
@@ -178,8 +209,11 @@ public class ClassScope extends Scope {
sourceType.setComponents(componentBindings);
}
private void checkAndSetModifiersForComponents(RecordComponentBinding compBinding, RecordComponent comp) {
- // TODO Auto-generated method stub
-
+ int modifiers = compBinding.modifiers;
+ int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag;
+ if (realModifiers != 0 && comp != null){
+ problemReporter().recordComponentsCannotHaveModifiers(comp);
+ }
}
void buildFields() {
@@ -319,6 +353,7 @@ public class ClassScope extends Scope {
LocalTypeBinding localType = buildLocalType(enclosingType, enclosingType.fPackage);
connectTypeHierarchy();
+ connectImplicitPermittedTypes();
if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
checkParameterizedTypeBounds();
checkParameterizedSuperTypeCollisions();
@@ -525,6 +560,8 @@ public class ClassScope extends Scope {
private void checkAndSetModifiers() {
SourceTypeBinding sourceType = this.referenceContext.binding;
int modifiers = sourceType.modifiers;
+ boolean isPreviewEnabled = compilerOptions().sourceLevel == ClassFileConstants.getLatestJDKLevel() &&
+ compilerOptions().enablePreviewFeatures;
if (sourceType.isRecord()) {
/* JLS 14 Records Sec 8.10 - A record declaration is implicitly final. */
modifiers |= ClassFileConstants.AccFinal;
@@ -553,14 +590,26 @@ public class ClassScope extends Scope {
}
} else if (sourceType.isLocalType()) {
if (sourceType.isEnum()) {
- problemReporter().illegalLocalTypeDeclaration(this.referenceContext);
- sourceType.modifiers = 0;
- return;
+ if (!isPreviewEnabled) {
+ problemReporter().illegalLocalTypeDeclaration(this.referenceContext);
+ sourceType.modifiers = 0;
+ return;
+ }
+ if ((modifiers & ClassFileConstants.AccStatic) != 0) {
+ problemReporter().recordIllegalStaticModifierForLocalClassOrInterface(sourceType);
+ return;
+ }
+ modifiers |= ClassFileConstants.AccStatic;
} else if (sourceType.isRecord()) {
if (enclosingType != null && enclosingType.isLocalType()) {
problemReporter().illegalLocalTypeDeclaration(this.referenceContext);
return;
}
+ if ((modifiers & ClassFileConstants.AccStatic) != 0) {
+ problemReporter().recordIllegalStaticModifierForLocalClassOrInterface(sourceType);
+ return;
+ }
+ modifiers |= ClassFileConstants.AccStatic;
}
if (sourceType.isAnonymousType()) {
if (compilerOptions().complianceLevel < ClassFileConstants.JDK9)
@@ -634,6 +683,15 @@ public class ClassScope extends Scope {
if ((realModifiers & unexpectedModifiers) != 0)
problemReporter().illegalModifierForLocalInterface(sourceType);
*/
+ } else if (isPreviewEnabled && sourceType.isLocalType()) {
+ final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface
+ | ClassFileConstants.AccStrictfp | ClassFileConstants.AccAnnotation);
+ if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
+ problemReporter().localStaticsIllegalVisibilityModifierForInterfaceLocalType(sourceType);
+// if ((modifiers & ClassFileConstants.AccStatic) != 0) {
+// problemReporter().recordIllegalStaticModifierForLocalClassOrInterface(sourceType);
+// }
+ modifiers |= ClassFileConstants.AccStatic;
} else {
final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccStrictfp | ClassFileConstants.AccAnnotation);
if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) {
@@ -650,11 +708,13 @@ public class ClassScope extends Scope {
modifiers |= ClassFileConstants.AccSynthetic;
}
modifiers |= ClassFileConstants.AccAbstract;
- } else if ((realModifiers & ClassFileConstants.AccEnum) != 0) {
+ } else if ((realModifiers & ClassFileConstants.AccEnum) != 0) {
+ boolean flagSealedNonModifiers = isPreviewEnabled &&
+ (modifiers & (ExtraCompilerModifiers.AccSealed | ExtraCompilerModifiers.AccNonSealed)) != 0;
// detect abnormal cases for enums
if (isMemberType) { // includes member types defined inside local types
final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccStatic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum);
- if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) {
+ if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers) {
problemReporter().illegalModifierForMemberEnum(sourceType);
modifiers &= ~ClassFileConstants.AccAbstract; // avoid leaking abstract modifier
realModifiers &= ~ClassFileConstants.AccAbstract;
@@ -665,7 +725,7 @@ public class ClassScope extends Scope {
// each enum constant is an anonymous local type and its modifiers were already checked as an enum constant field
} else {
final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum);
- if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
+ if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers)
problemReporter().illegalModifierForEnum(sourceType);
}
if (!sourceType.isAnonymousType()) {
@@ -721,6 +781,8 @@ public class ClassScope extends Scope {
}
modifiers |= ClassFileConstants.AccFinal;
}
+ if (isPreviewEnabled && (modifiers & ClassFileConstants.AccFinal) == 0)
+ modifiers |= ExtraCompilerModifiers.AccSealed;
}
} else if (sourceType.isRecord()) {
if (isMemberType) {
@@ -733,7 +795,9 @@ public class ClassScope extends Scope {
problemReporter().illegalModifierForLocalClass(sourceType);
} else {
final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp);
- if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
+ if ((realModifiers & UNEXPECTED_MODIFIERS) != 0
+ || (modifiers & ExtraCompilerModifiers.AccNonSealed) != 0
+ || (modifiers & ExtraCompilerModifiers.AccSealed) != 0)
problemReporter().illegalModifierForRecord(sourceType);
}
// JLS 14 8.10 : It is a compile-time error if a record declaration has the modifier abstract.
@@ -760,8 +824,11 @@ public class ClassScope extends Scope {
if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
problemReporter().illegalModifierForMemberClass(sourceType);
} else if (sourceType.isLocalType()) {
+ boolean flagSealedNonModifiers = compilerOptions().sourceLevel >= ClassFileConstants.JDK15 &&
+ compilerOptions().enablePreviewFeatures &&
+ (modifiers & (ExtraCompilerModifiers.AccSealed | ExtraCompilerModifiers.AccNonSealed)) != 0;
final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp);
- if ((realModifiers & UNEXPECTED_MODIFIERS) != 0)
+ if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers)
problemReporter().illegalModifierForLocalClass(sourceType);
} else {
final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp);
@@ -1053,6 +1120,7 @@ public class ClassScope extends Scope {
if (sourceType.id == TypeIds.T_JavaLangObject) { // handle the case of redefining java.lang.Object up front
sourceType.setSuperClass(null);
sourceType.setSuperInterfaces(Binding.NO_SUPERINTERFACES);
+ sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
if (!sourceType.isClass())
problemReporter().objectMustBeClass(sourceType);
if (this.referenceContext.superclass != null || (this.referenceContext.superInterfaces != null && this.referenceContext.superInterfaces.length > 0))
@@ -1140,6 +1208,99 @@ public class ClassScope extends Scope {
}
return !foundCycle;
}
+ // Call only when we know there's no explicit permits clause and this is a sealed type
+ private void connectImplicitPermittedTypes(SourceTypeBinding sourceType) {
+ List<SourceTypeBinding> types = new ArrayList<>();
+ for (TypeDeclaration typeDecl : this.referenceCompilationUnit().types) {
+ types.addAll(sourceType.collectAllTypeBindings(typeDecl, this.compilationUnitScope()));
+ }
+ Set<ReferenceBinding> permSubTypes = new LinkedHashSet<>();
+ for (ReferenceBinding type : types) {
+ if (!TypeBinding.equalsEquals(type, sourceType) && type.findSuperTypeOriginatingFrom(sourceType) != null) {
+ permSubTypes.add(type);
+ }
+ }
+ if (permSubTypes.size() == 0) {
+ problemReporter().sealedSealedTypeMissingPermits(sourceType, this.referenceContext);
+ return;
+ }
+ sourceType.setPermittedTypes(permSubTypes.toArray(new ReferenceBinding[0]));
+ }
+/**
+ * @see #connectPermittedTypes()
+ */
+ void connectImplicitPermittedTypes() {
+ TypeDeclaration typeDecl = this.referenceContext;
+ SourceTypeBinding sourceType = typeDecl.binding;
+ if (sourceType.id == TypeIds.T_JavaLangObject || sourceType.isEnum() || sourceType.isRecord()) // already handled
+ return;
+ if (sourceType.isSealed() && (typeDecl.permittedTypes == null ||
+ typeDecl.permittedTypes.length == 0)) {
+ connectImplicitPermittedTypes(sourceType);
+ }
+ ReferenceBinding[] memberTypes = sourceType.memberTypes;
+ if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES) {
+ for (int i = 0, size = memberTypes.length; i < size; i++)
+ ((SourceTypeBinding) memberTypes[i]).scope.connectImplicitPermittedTypes();
+ }
+ }
+ /**
+ * This method only deals with the permitted types that are explicitly declared
+ * in a type's permits clause. The implicitly permitted types are all filled in
+ * in {@link #connectImplicitPermittedTypes()}. The reason being, the implicitly
+ * permitted types require the complete type hierarchy to be ready. Therefore, this
+ * method is called inside {@link #connectTypeHierarchy()} and connectImplicitPermittedTypes()
+ * is called after the connectTypeHierarchy(). Why can't we do both after connectTypeHierarchy()?
+ * That is because, in a very specific case of one of an explicitly permitted type also being
+ * a member type and is referenced in the permits clause without type qualifier, we would allow
+ * the following incorrect code:
+ * <pre>
+ * public sealed class X permits Y {
+ * final class Y extends X {}
+ * }
+ * </pre>
+ * If we were to resolve <code>Y</code> in <code>permits Y</code> after resolving
+ * the hierarchy, Y is resolved in current scope. However, Y should only be
+ * allowed with the qualifier, in this case, X.Y.
+ */
+ void connectPermittedTypes() {
+ SourceTypeBinding sourceType = this.referenceContext.binding;
+ sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
+ if (this.referenceContext.permittedTypes == null) {
+ return;
+ }
+ if (sourceType.id == TypeIds.T_JavaLangObject || sourceType.isEnum()) // already handled
+ return;
+
+ int length = this.referenceContext.permittedTypes.length;
+ ReferenceBinding[] permittedTypeBindings = new ReferenceBinding[length];
+ int count = 0;
+ nextPermittedType : for (int i = 0; i < length; i++) {
+ TypeReference permittedTypeRef = this.referenceContext.permittedTypes[i];
+ ReferenceBinding permittedType = findPermittedtype(permittedTypeRef);
+ if (permittedType == null) { // detected cycle
+ continue nextPermittedType;
+ }
+ // check for simple interface collisions
+ // Check for a duplicate interface once the name is resolved, otherwise we may be confused (i.e. a.b.I and c.d.I)
+ for (int j = 0; j < i; j++) {
+ if (TypeBinding.equalsEquals(permittedTypeBindings[j], permittedType)) {
+ problemReporter().sealedDuplicateTypeInPermits(sourceType, permittedTypeRef, permittedType);
+ continue nextPermittedType;
+ }
+ }
+ // only want to reach here when no errors are reported
+ permittedTypeBindings[count++] = permittedType;
+ }
+ // hold onto all correctly resolved superinterfaces
+ if (count > 0) {
+ if (count != length)
+ System.arraycopy(permittedTypeBindings, 0, permittedTypeBindings = new ReferenceBinding[count], 0, count);
+ sourceType.setPermittedTypes(permittedTypeBindings);
+ } else {
+ sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
+ }
+ }
private boolean connectRecordSuperclass() {
SourceTypeBinding sourceType = this.referenceContext.binding;
@@ -1245,6 +1406,7 @@ public class ClassScope extends Scope {
environment().typesBeingConnected.add(sourceType);
boolean noProblems = connectSuperclass();
noProblems &= connectSuperInterfaces();
+ connectPermittedTypes();
environment().typesBeingConnected.remove(sourceType);
sourceType.tagBits |= TagBits.EndHierarchyCheck;
noProblems &= connectTypeVariables(this.referenceContext.typeParameters, false);
@@ -1303,6 +1465,7 @@ public class ClassScope extends Scope {
environment().typesBeingConnected.add(sourceType);
boolean noProblems = connectSuperclass();
noProblems &= connectSuperInterfaces();
+ connectPermittedTypes();
environment().typesBeingConnected.remove(sourceType);
sourceType.tagBits |= TagBits.EndHierarchyCheck;
noProblems &= connectTypeVariables(this.referenceContext.typeParameters, false);
@@ -1462,6 +1625,7 @@ public class ClassScope extends Scope {
} catch (AbortCompilation e) {
SourceTypeBinding sourceType = this.referenceContext.binding;
if (sourceType.superInterfaces == null) sourceType.setSuperInterfaces(Binding.NO_SUPERINTERFACES); // be more resilient for hierarchies (144976)
+ if (sourceType.permittedTypes == null) sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
e.updateContext(typeReference, referenceCompilationUnit().compilationResult);
throw e;
} finally {
@@ -1470,6 +1634,24 @@ public class ClassScope extends Scope {
}
}
+ private ReferenceBinding findPermittedtype(TypeReference typeReference) {
+ CompilationUnitScope unitScope = compilationUnitScope();
+ LookupEnvironment env = unitScope.environment;
+ try {
+ env.missingClassFileLocation = typeReference;
+ typeReference.aboutToResolve(this); // allows us to trap completion & selection nodes
+ unitScope.recordQualifiedReference(typeReference.getTypeName());
+ ReferenceBinding permittedType = (ReferenceBinding) typeReference.resolveType(this);
+ return permittedType;
+ } catch (AbortCompilation e) {
+ SourceTypeBinding sourceType = this.referenceContext.binding;
+ if (sourceType.permittedTypes == null) sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
+ e.updateContext(typeReference, referenceCompilationUnit().compilationResult);
+ throw e;
+ } finally {
+ env.missingClassFileLocation = null;
+ }
+ }
/* Answer the problem reporter to use for raising new problems.
*
* Note that as a side-effect, this updates the current reference context
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index 2d3d952226..4d577a7785 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -365,6 +365,10 @@ public char[] computeConstantPoolName(LocalTypeBinding localType) {
void connectTypeHierarchy() {
for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
this.topLevelTypes[i].scope.connectTypeHierarchy();
+ // Wait for all hierarchy information to be built before
+ // checking on permitted types
+ for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
+ this.topLevelTypes[i].scope.connectImplicitPermittedTypes();
}
void faultInImports() {
if (this.tempImports != null)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtendedTagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtendedTagBits.java
index 42a43d4905..c7c7dcf478 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtendedTagBits.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtendedTagBits.java
@@ -18,5 +18,6 @@ import org.eclipse.jdt.internal.compiler.ast.ASTNode;
public interface ExtendedTagBits {
int AreRecordComponentsComplete = ASTNode.Bit1;
+ int HasUnresolvedPermittedSubtypes = ASTNode.Bit2;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java
index e142a5896e..1c0cb5f2ac 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java
@@ -45,12 +45,14 @@ public interface ExtraCompilerModifiers { // modifier constant
final int AccUnresolved = ASTNode.Bit26;
final int AccBlankFinal = ASTNode.Bit27; // for blank final variables
final int AccIsDefaultConstructor = ASTNode.Bit27; // for default constructor
+ final int AccNonSealed = ASTNode.Bit27; // for class/interface
final int AccLocallyUsed = ASTNode.Bit28; // used to diagnose unused (a) private/local members or (b) members of private classes
// generally set when actual usage has been detected
// or, (b) when member of a private class is exposed via a non-private subclass
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=328281
final int AccVisibilityMASK = ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate;
+ final int AccSealed = ASTNode.Bit29; // used for class/interface to set sealed
final int AccOverriding = ASTNode.Bit29; // record fact a method overrides another one
final int AccImplementing = ASTNode.Bit30; // record fact a method implements another one (it is concrete and overrides an abstract one)
final int AccGenericSignature = ASTNode.Bit31; // record fact a type/method/field involves generics in its signature (and need special signature attr)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
index afb5f22e0d..b37cc5a28f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -40,6 +40,9 @@ public interface InvocationSite {
boolean receiverIsImplicitThis();
boolean checkingPotentialCompatibility();
void acceptPotentiallyCompatibleMethods(MethodBinding [] methods);
+ public default LocalVariableBinding[] getPatternVariablesWhenTrue() {
+ return null;
+ }
/** When inference for this invocationSite starts, get a fresh inference context, initialized from this site. */
InferenceContext18 freshInferenceContext(Scope scope);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
index c251ad855c..a09a3f0a7b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
@@ -8,7 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
* bug 349326 - [1.7] new warning for missing try-with-resources
@@ -67,6 +66,8 @@ public class MethodScope extends BlockScope {
// remember suppressed warning re missing 'default:' to give hints on possibly related flow problems
public boolean hasMissingSwitchDefault; // TODO(stephan): combine flags to a bitset?
+ public boolean isCompactConstructorScope = false;
+
static {
if (Boolean.getBoolean("jdt.flow.test.extra")) { //$NON-NLS-1$
baseAnalysisIndex = 64;
@@ -115,7 +116,9 @@ private void checkAndSetModifiersForConstructor(MethodBinding methodBinding) {
if ((modifiers & ExtraCompilerModifiers.AccAlternateModifierProblem) != 0)
problemReporter().duplicateModifierForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext);
- if ((((ConstructorDeclaration) this.referenceContext).bits & ASTNode.IsDefaultConstructor) != 0) {
+ int astNodeBits = ((ConstructorDeclaration) this.referenceContext).bits;
+ if ((astNodeBits & ASTNode.IsDefaultConstructor) != 0
+ ||((astNodeBits & ASTNode.IsImplicit) != 0 && (astNodeBits & ASTNode.IsCanonicalConstructor) != 0)) {
// certain flags are propagated from declaring class onto constructor
final int DECLARING_FLAGS = ClassFileConstants.AccEnum|ClassFileConstants.AccPublic|ClassFileConstants.AccProtected;
final int VISIBILITY_FLAGS = ClassFileConstants.AccPrivate|ClassFileConstants.AccPublic|ClassFileConstants.AccProtected;
@@ -152,10 +155,6 @@ private void checkAndSetModifiersForConstructor(MethodBinding methodBinding) {
} else if ((((AbstractMethodDeclaration) this.referenceContext).modifiers & ClassFileConstants.AccStrictfp) != 0) {
// must check the parse node explicitly
problemReporter().illegalModifierForMethod((AbstractMethodDeclaration) this.referenceContext);
- } else if (this.referenceContext instanceof CompactConstructorDeclaration) {
- if ((((AbstractMethodDeclaration) this.referenceContext).modifiers & ClassFileConstants.AccPublic) == 0) {
- problemReporter().recordCanonicalConstructorNotPublic((AbstractMethodDeclaration) this.referenceContext);
- }
}
// check for incompatible modifiers in the visibility bits, isolate the visibility bits
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java
index 2ba5a784a1..389d8d49e3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -38,6 +38,7 @@ public MissingTypeBinding(PackageBinding packageBinding, char[][] compoundName,
this.modifiers = ClassFileConstants.AccPublic;
this.superclass = null; // will be fixed up using #setMissingSuperclass(...)
this.superInterfaces = Binding.NO_SUPERINTERFACES;
+ this.permittedSubtypes = Binding.NO_PERMITTEDTYPES;
this.typeVariables = Binding.NO_TYPE_VARIABLES;
this.memberTypes = Binding.NO_MEMBER_TYPES;
this.fields = Binding.NO_FIELDS;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java
index 90f7a9beef..15462264d4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java
@@ -82,7 +82,8 @@ public SyntheticArgumentBinding addSyntheticArgument(LocalVariableBinding actual
public SyntheticArgumentBinding addSyntheticArgument(ReferenceBinding targetEnclosingType) {
if (!isPrototype()) throw new IllegalStateException();
if (isStatic()) {
- assert this.isRecord();// a local record is implicitly static; no other local type can be static
+ // Ref JLS 6.1 due to record preview add-on doc: Local Static Interfaces and Enum Classes
+ // a local record, enum and interface allowed, and will be implicitly static
return null;
}
SyntheticArgumentBinding synthLocal = null;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index 47efd2fbe7..b978c92403 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -1509,6 +1509,19 @@ private boolean isCompatibleWith0(TypeBinding otherType, /*@Nullable*/ Scope cap
return false;
}
}
+/**
+ * Answer true if the receiver has non-sealed modifier
+ */
+public final boolean isNonSealed() {
+ return (this.modifiers & ExtraCompilerModifiers.AccNonSealed) != 0;
+}
+
+/**
+ * Answer true if the receiver has sealed modifier
+ */
+public boolean isSealed() {
+ return (this.modifiers & ExtraCompilerModifiers.AccSealed) != 0;
+}
@Override
public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) {
@@ -2040,6 +2053,11 @@ public ReferenceBinding superclass() {
}
@Override
+public ReferenceBinding[] permittedTypes() {
+ return Binding.NO_PERMITTEDTYPES;
+}
+
+@Override
public ReferenceBinding[] superInterfaces() {
return Binding.NO_SUPERINTERFACES;
}
@@ -2402,6 +2420,8 @@ public ModuleBinding module() {
public boolean hasEnclosingInstanceContext() {
if (isMemberType() && !isStatic())
return true;
+ if (isLocalType() && isStatic())
+ return false;
MethodBinding enclosingMethod = enclosingMethod();
if (enclosingMethod != null)
return !enclosingMethod.isStatic();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index a328f9b517..c61885761e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -2034,8 +2034,7 @@ public abstract class Scope {
return typeBinding;
}
- public LocalVariableBinding findVariable(char[] variable) {
-
+ public LocalVariableBinding findVariable(char[] variable, InvocationSite invocationSite) {
return null;
}
@@ -2090,7 +2089,7 @@ public abstract class Scope {
//$FALL-THROUGH$ could duplicate the code below to save a cast - questionable optimization
case BLOCK_SCOPE :
- LocalVariableBinding variableBinding = scope.findVariable(name);
+ LocalVariableBinding variableBinding = scope.findVariable(name, invocationSite);
// looks in this scope only
if (variableBinding != null) {
if (foundField != null && foundField.isValidBinding())
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 8fc628dc63..58fcc42f33 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -53,6 +53,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -60,7 +61,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
@@ -103,6 +106,7 @@ public class SourceTypeBinding extends ReferenceBinding {
private MethodBinding[] methods; // MUST NOT be modified directly, use setter !
public ReferenceBinding[] memberTypes; // MUST NOT be modified directly, use setter !
public TypeVariableBinding[] typeVariables; // MUST NOT be modified directly, use setter !
+ public ReferenceBinding[] permittedTypes; // MUST NOT be modified directly, use setter !
public ClassScope scope;
protected SourceTypeBinding prototype;
@@ -902,7 +906,7 @@ public List<MethodBinding> checkAndAddSyntheticRecordComponentAccessors(MethodBi
accessors = Arrays.stream(methodBindings)
.filter(m -> m.selector != null && m.selector.length > 0)
.filter(m -> filteredComponents.contains(new String(m.selector)))
- .filter(m -> m.parameters == null || m.parameters.length == 0)
+ .filter(m -> m.parameterNames == null || m.parameterNames.length == 0)
.collect(Collectors.toList());
List<String> candidates = accessors.stream()
@@ -913,8 +917,8 @@ public List<MethodBinding> checkAndAddSyntheticRecordComponentAccessors(MethodBi
int missingCount = filteredComponents.size();
for (int i = 0; i < missingCount; ++i) {
RecordComponentBinding rcb = this.getRecordComponent(filteredComponents.get(i).toCharArray());
- assert rcb != null;
- implicitMethods.add(addSyntheticRecordComponentAccessor(rcb, i));
+ if (rcb != null)
+ implicitMethods.add(addSyntheticRecordComponentAccessor(rcb, i));
}
accessors.addAll(implicitMethods);
this.recordComponentAccessors = accessors.toArray(new MethodBinding[0]);
@@ -1067,9 +1071,195 @@ private void checkAnnotationsInType() {
void faultInTypesForFieldsAndMethods() {
if (!isPrototype()) throw new IllegalStateException();
+ checkPermitsInType();
checkAnnotationsInType();
internalFaultInTypeForFieldsAndMethods();
}
+
+private Map.Entry<TypeReference, ReferenceBinding> getFirstSealedSuperTypeOrInterface(TypeDeclaration typeDecl) {
+ boolean isAnySuperTypeSealed = this.superclass != null ? this.superclass.isSealed() : false;
+ if (isAnySuperTypeSealed)
+ return new AbstractMap.SimpleEntry<>(typeDecl.superclass, this.superclass);
+
+ ReferenceBinding[] superInterfaces1 = this.superInterfaces();
+ int l = superInterfaces1 != null ? superInterfaces1.length : 0;
+ for (int i = 0; i < l; ++i) {
+ ReferenceBinding superInterface = superInterfaces1[i];
+ if (superInterface.isSealed()) {
+ return new AbstractMap.SimpleEntry<>(typeDecl.superInterfaces[i], superInterface);
+ }
+ }
+ return null;
+}
+// TODO: Optimize the multiple loops - defer until the feature becomes standard.
+private void checkPermitsInType() {
+ if (this.isRecordDeclaration || this.isEnum())
+ return; // handled separately
+ TypeDeclaration typeDecl = this.scope.referenceContext;
+ if (this.isInterface()) {
+ if (isSealed() && isNonSealed()) {
+ this.scope.problemReporter().sealedInterfaceIsSealedAndNonSealed(this, typeDecl);
+ return;
+ }
+ }
+ boolean hasPermittedTypes = this.permittedTypes != null && this.permittedTypes.length > 0;
+ if (hasPermittedTypes) {
+ if (!this.isSealed())
+ this.scope.problemReporter().sealedMissingSealedModifier(this, typeDecl);
+ ModuleBinding sourceModuleBinding = this.module();
+ boolean isUnnamedModule = sourceModuleBinding.isUnnamed();
+ if (isUnnamedModule) {
+ PackageBinding sourceTypePackage = this.getPackage();
+ for (int i =0, l = this.permittedTypes.length; i < l; i++) {
+ ReferenceBinding permType = this.permittedTypes[i];
+ if (!permType.isValidBinding()) continue;
+ if (sourceTypePackage != permType.getPackage()) {
+ TypeReference permittedTypeRef = typeDecl.permittedTypes[i];
+ this.scope.problemReporter().sealedPermittedTypeOutsideOfPackage(permType, this, permittedTypeRef, sourceTypePackage);
+ }
+ }
+ } else {
+ for (int i = 0, l = this.permittedTypes.length; i < l; i++) {
+ ReferenceBinding permType = this.permittedTypes[i];
+ if (!permType.isValidBinding()) continue;
+ ModuleBinding permTypeModule = permType.module();
+ if (sourceModuleBinding != permTypeModule) {
+ TypeReference permittedTypeRef = typeDecl.permittedTypes[i];
+ this.scope.problemReporter().sealedPermittedTypeOutsideOfModule(permType, this, permittedTypeRef, sourceModuleBinding);
+ }
+ }
+ }
+ }
+
+// ReferenceBinding superType = this.superclass();
+ Map.Entry<TypeReference, ReferenceBinding> sealedEntry = getFirstSealedSuperTypeOrInterface(typeDecl);
+ boolean foundSealedSuperTypeOrInterface = sealedEntry != null;
+ if (this.isLocalType()) {
+ if (this.isSealed() || this.isNonSealed())
+ return; // already handled elsewhere
+ if (foundSealedSuperTypeOrInterface) {
+ this.scope.problemReporter().sealedLocalDirectSuperTypeSealed(this, sealedEntry.getKey(), sealedEntry.getValue());
+ return;
+ }
+ } else if (this.isNonSealed()) {
+ if (!foundSealedSuperTypeOrInterface) {
+ if (this.isClass())
+ this.scope.problemReporter().sealedDisAllowedNonSealedModifierInClass(this, typeDecl);
+ else if (this.isInterface())
+ this.scope.problemReporter().sealedDisAllowedNonSealedModifierInInterface(this, typeDecl);
+ }
+ }
+ if (foundSealedSuperTypeOrInterface) {
+ if (!(this.isFinal() || this.isSealed() || this.isNonSealed())) {
+ if (this.isClass())
+ this.scope.problemReporter().sealedMissingClassModifier(this, typeDecl, sealedEntry.getValue());
+ else if (this.isInterface())
+ this.scope.problemReporter().sealedMissingInterfaceModifier(this, typeDecl, sealedEntry.getValue());
+ }
+ List<SourceTypeBinding> typesInCU = collectAllTypeBindings(typeDecl, this.scope.compilationUnitScope());
+ if (typeDecl.superclass != null && !checkPermitsAndAdd(this.superclass, typesInCU))
+ this.scope.problemReporter().sealedSuperClassDoesNotPermit(this, typeDecl.superclass, this.superclass);
+ for (int i = 0, l = this.superInterfaces.length; i < l; ++i) {
+ ReferenceBinding superInterface = this.superInterfaces[i];
+ if (superInterface != null && !checkPermitsAndAdd(superInterface, typesInCU)) {
+ TypeReference superInterfaceRef = typeDecl.superInterfaces[i];
+ if (this.isClass())
+ this.scope.problemReporter().sealedSuperClassDoesNotPermit(this, superInterfaceRef, superInterface);
+ else if (this.isInterface())
+ this.scope.problemReporter().sealedSuperInterfaceDoesNotPermit(this, superInterfaceRef, superInterface);
+ }
+ }
+ }
+ for (int i = 0, length = this.memberTypes.length; i < length; i++)
+ ((SourceTypeBinding) this.memberTypes[i]).checkPermitsInType();
+
+ if (this.scope.referenceContext.permittedTypes == null) {
+ // Ignore implicitly permitted case
+ return;
+ }
+ // In case of errors, be safe.
+ int l = this.permittedTypes.length <= this.scope.referenceContext.permittedTypes.length ?
+ this.permittedTypes.length : this.scope.referenceContext.permittedTypes.length;
+ for (int i = 0; i < l; i++) {
+ TypeReference permittedTypeRef = this.scope.referenceContext.permittedTypes[i];
+ ReferenceBinding permittedType = this.permittedTypes[i];
+ if (permittedType == null || !permittedType.isValidBinding())
+ continue;
+ if (this.isClass()) {
+ ReferenceBinding permSuperType = permittedType.superclass();
+ if (!TypeBinding.equalsEquals(this, permSuperType)) {
+ this.scope.problemReporter().sealedNotDirectSuperClass(permittedType, permittedTypeRef, this);
+ continue;
+ }
+ } else if (this.isInterface()) {
+ ReferenceBinding[] permSuperInterfaces = permittedType.superInterfaces();
+ boolean foundSuperInterface = false;
+ if (permSuperInterfaces != null) {
+ for (ReferenceBinding psi : permSuperInterfaces) {
+ if (TypeBinding.equalsEquals(this, psi)) {
+ foundSuperInterface = true;
+ break;
+ }
+ }
+ if (!foundSuperInterface) {
+ this.scope.problemReporter().sealedNotDirectSuperInterface(permittedType, permittedTypeRef, this);
+ continue;
+ }
+ }
+ }
+ }
+ return;
+}
+public List<SourceTypeBinding> collectAllTypeBindings(TypeDeclaration typeDecl, CompilationUnitScope unitScope) {
+ class TypeBindingsCollector extends ASTVisitor {
+ List<SourceTypeBinding> types = new ArrayList<>();
+ @Override
+ public boolean visit(
+ TypeDeclaration localTypeDeclaration,
+ BlockScope scope1) {
+ checkAndAddBinding(localTypeDeclaration.binding);
+ return true;
+ }
+ @Override
+ public boolean visit(
+ TypeDeclaration memberTypeDeclaration,
+ ClassScope scope1) {
+ checkAndAddBinding(memberTypeDeclaration.binding);
+ return true;
+ }
+ @Override
+ public boolean visit(
+ TypeDeclaration typeDeclaration,
+ CompilationUnitScope scope1) {
+ checkAndAddBinding(typeDeclaration.binding);
+ return true; // do nothing by default, keep traversing
+ }
+ private void checkAndAddBinding(SourceTypeBinding stb) {
+ if (stb != null)
+ this.types.add(stb);
+ }
+ }
+ TypeBindingsCollector typeCollector = new TypeBindingsCollector();
+ typeDecl.traverse(typeCollector, unitScope);
+ return typeCollector.types;
+}
+
+private boolean checkPermitsAndAdd(ReferenceBinding superType, List<SourceTypeBinding> types) {
+ if (superType == null
+ || superType.equals(this.scope.getJavaLangObject()))
+ return true;
+ if (superType.isSealed()) {
+ if (superType.isParameterizedType() || superType.isRawType())
+ superType = superType.actualType();
+ ReferenceBinding[] superPermittedTypes = superType.permittedTypes();
+ for (ReferenceBinding permittedType : superPermittedTypes) {
+ if (permittedType.isValidBinding() && TypeBinding.equalsEquals(this, permittedType))
+ return true;
+ }
+ }
+ return false;
+}
+
public RecordComponentBinding[] components() {
if (!this.isRecordDeclaration)
@@ -1111,7 +1301,8 @@ public RecordComponentBinding[] components() {
if (rcb.type instanceof TypeVariableBinding ||
rcb.type instanceof ParameterizedTypeBinding)
smb.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
- smb.returnType = rcb.type;
+ // Don't copy the annotations to the accessor method's return type from record component
+ smb.returnType = rcb.type.unannotated();
// add code for implicit canonical constructor argument annotations also
for (FieldBinding f : this.fields) {
if (f.isRecordComponent() && CharOperation.equals(f.name, rcb.name)) {
@@ -1879,32 +2070,38 @@ private int getImplicitCanonicalConstructor() {
}
return -1;
}
-private MethodBinding[] checkAndGetExplicitCanonicalConstructors() {
- List<MethodBinding> ec = new ArrayList<>();
- if (!this.isRecordDeclaration)
- return ec.toArray(new MethodBinding[0]);
-
+private void checkAndGetExplicitCanonicalConstructors() {
RecordComponentBinding[] recComps = this.components;
int nRecordComponents = recComps.length;
- if (this.methods != null && this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK14) {
- for (MethodBinding method : this.methods) {
- if (!method.isConstructor() || (method.tagBits & TagBits.isImplicit) != 0
- || method.parameters.length != nRecordComponents)
- continue;
- boolean isEC = true;
- for (int j = 0; j < nRecordComponents; ++j) {
- if (TypeBinding.notEquals(method.parameters[j], recComps[j].type)) {
- isEC = false;
- break;
- }
- }
- if (isEC) {
- ec.add(method);
- checkRecordCanonicalConstructor(method);
+ MethodBinding implicitCanConstr = null;
+ MethodBinding explictCanConstr = null;
+ for (MethodBinding method : this.methods) {
+ if (!method.isConstructor())
+ continue;
+ if ((method.tagBits & TagBits.isImplicit) != 0) {
+ implicitCanConstr = method;
+ continue;
+ }
+ if (method.parameters.length != nRecordComponents)
+ continue;
+ boolean isEC = true;
+ for (int j = 0; j < nRecordComponents; ++j) {
+ if (TypeBinding.notEquals(method.parameters[j], recComps[j].type)) {
+ isEC = false;
+ break;
}
}
+ if (isEC) {
+ checkRecordCanonicalConstructor(method);
+ // Just exit after sighting the first explicit canonical constructor,
+ // because there can only be one.
+ explictCanConstr = method;
+ break;
+ }
+ }
+ if (explictCanConstr == null && implicitCanConstr != null) {
+ checkAndFlagHeapPollution(implicitCanConstr, implicitCanConstr.sourceMethod());
}
- return ec.toArray(new MethodBinding[0]);
}
private int getImplicitMethod(char[] name) {
if (this.methods != null && this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK14) {
@@ -1968,9 +2165,12 @@ public MethodBinding[] methods() {
// find & report collision cases
boolean complyTo15OrAbove = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
boolean compliance16 = this.scope.compilerOptions().complianceLevel == ClassFileConstants.JDK1_6;
- int recordCanonIndex = getImplicitCanonicalConstructor();
- computeRecordComponents();
- checkAndGetExplicitCanonicalConstructors();
+ int recordCanonIndex = -1;
+ if (this.isRecordDeclaration) {
+ recordCanonIndex = getImplicitCanonicalConstructor();
+ computeRecordComponents();
+ checkAndGetExplicitCanonicalConstructors();
+ }
int recordEqualsIndex = getImplicitMethod(TypeConstants.EQUALS);
for (int i = 0, length = this.methods.length; i < length; i++) {
@@ -2176,16 +2376,49 @@ public MethodBinding[] methods() {
return this.methods;
}
+static boolean isAtleastAsAccessibleAsRecord(MethodBinding canonicalConstructor) {
+ ReferenceBinding enclosingRecord = canonicalConstructor.declaringClass;
+ if (enclosingRecord.isPublic())
+ return canonicalConstructor.isPublic();
+
+ if (enclosingRecord.isProtected())
+ return canonicalConstructor.isPublic() || canonicalConstructor.isProtected();
+
+ if (enclosingRecord.isPrivate())
+ return true;
+
+ /* package visibility */
+ return !canonicalConstructor.isPrivate();
+}
+
+private void checkCanonicalConstructorParameterNames(MethodBinding explicitCanonicalConstructor,
+ AbstractMethodDeclaration methodDecl) {
+ int l = explicitCanonicalConstructor.parameters != null ? explicitCanonicalConstructor.parameters.length : 0;
+ if (l == 0) return;
+ ReferenceBinding enclosingRecord = explicitCanonicalConstructor.declaringClass;
+ assert enclosingRecord.isRecord();
+ assert enclosingRecord instanceof SourceTypeBinding;
+ SourceTypeBinding recordBinding = (SourceTypeBinding) enclosingRecord;
+ RecordComponentBinding[] comps = recordBinding.components();
+ Argument[] args = methodDecl.arguments;
+ for (int i = 0; i < l; ++i) {
+ if (!CharOperation.equals(args[i].name, comps[i].name))
+ this.scope.problemReporter().recordIllegalParameterNameInCanonicalConstructor(comps[i], args[i]);
+ }
+}
+
private void checkRecordCanonicalConstructor(MethodBinding explicitCanonicalConstructor) {
AbstractMethodDeclaration methodDecl = explicitCanonicalConstructor.sourceMethod();
- if (!explicitCanonicalConstructor.isPublic())
- this.scope.problemReporter().recordCanonicalConstructorNotPublic(methodDecl);
+
+ if (!SourceTypeBinding.isAtleastAsAccessibleAsRecord(explicitCanonicalConstructor))
+ this.scope.problemReporter().recordCanonicalConstructorVisibilityReduced(methodDecl);
TypeParameter[] typeParameters = methodDecl.typeParameters();
if (typeParameters != null && typeParameters.length > 0)
this.scope.problemReporter().recordCanonicalConstructorShouldNotBeGeneric(methodDecl);
if (explicitCanonicalConstructor.thrownExceptions != null && explicitCanonicalConstructor.thrownExceptions.length > 0)
this.scope.problemReporter().recordCanonicalConstructorHasThrowsClause(methodDecl);
+ checkCanonicalConstructorParameterNames(explicitCanonicalConstructor, methodDecl);
explicitCanonicalConstructor.tagBits |= TagBits.IsCanonicalConstructor;
ASTVisitor visitor = new ASTVisitor() {
boolean isInsideCCD = methodDecl instanceof CompactConstructorDeclaration;
@@ -2220,6 +2453,11 @@ private void checkRecordCanonicalConstructor(MethodBinding explicitCanonicalCons
}
@Override
+public ReferenceBinding[] permittedTypes() {
+ return this.permittedTypes;
+}
+
+@Override
public TypeBinding prototype() {
return this.prototype;
}
@@ -2309,9 +2547,9 @@ public FieldBinding resolveTypeFor(FieldBinding field) {
// copy annotations from record component if applicable
if (field.isRecordComponent()) {
RecordComponentBinding rcb = getRecordComponent(field.name);
- assert rcb != null;
- relevantRecordComponentAnnotations = ASTNode.copyRecordComponentAnnotations(initializationScope,
- field, rcb.sourceRecordComponent().annotations);
+ if (rcb != null)
+ relevantRecordComponentAnnotations = ASTNode.copyRecordComponentAnnotations(initializationScope,
+ field, rcb.sourceRecordComponent().annotations);
}
}
if (sourceLevel >= ClassFileConstants.JDK1_8) {
@@ -2500,10 +2738,8 @@ private MethodBinding resolveTypesWithSuspendedTempErrorHandlingPolicy(MethodBin
&& !(sourceLevel >= ClassFileConstants.JDK9 && method.isPrivate())) {
methodDecl.scope.problemReporter().safeVarargsOnNonFinalInstanceMethod(method);
}
- } else if (method.parameters != null && method.parameters.length > 0 && method.isVarargs()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=337795
- if (!method.parameters[method.parameters.length - 1].isReifiable()) {
- methodDecl.scope.problemReporter().possibleHeapPollutionFromVararg(methodDecl.arguments[methodDecl.arguments.length - 1]);
- }
+ } else if ((method.tagBits & TagBits.IsCanonicalConstructor) == 0) {
+ checkAndFlagHeapPollution(method, methodDecl);
}
}
@@ -2599,6 +2835,14 @@ private MethodBinding resolveTypesWithSuspendedTempErrorHandlingPolicy(MethodBin
}
return method;
}
+
+private void checkAndFlagHeapPollution(MethodBinding method, AbstractMethodDeclaration methodDecl) {
+ if (method.parameters != null && method.parameters.length > 0 && method.isVarargs()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=337795
+ if (!method.parameters[method.parameters.length - 1].isReifiable()) {
+ methodDecl.scope.problemReporter().possibleHeapPollutionFromVararg(methodDecl.arguments[methodDecl.arguments.length - 1]);
+ }
+ }
+}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=391108
private static void rejectTypeAnnotatedVoidMethod(AbstractMethodDeclaration methodDecl) {
Annotation[] annotations = methodDecl.annotations;
@@ -2829,6 +3073,22 @@ public MethodBinding [] setMethods(MethodBinding[] methods) {
return this.methods = methods;
}
+//Propagate writes to all annotated variants so the clones evolve along.
+public ReferenceBinding [] setPermittedTypes(ReferenceBinding [] permittedTypes) {
+
+ if (!isPrototype())
+ return this.prototype.setPermittedTypes(permittedTypes);
+
+ if ((this.tagBits & TagBits.HasAnnotatedVariants) != 0) {
+ TypeBinding [] annotatedTypes = this.scope.environment().getAnnotatedTypes(this);
+ for (int i = 0, length = annotatedTypes == null ? 0 : annotatedTypes.length; i < length; i++) {
+ SourceTypeBinding annotatedType = (SourceTypeBinding) annotatedTypes[i];
+ annotatedType.permittedTypes = permittedTypes;
+ }
+ }
+ return this.permittedTypes = permittedTypes;
+}
+
// Propagate writes to all annotated variants so the clones evolve along.
public ReferenceBinding setSuperClass(ReferenceBinding superClass) {
@@ -3211,15 +3471,13 @@ public MethodBinding getRecordComponentAccessor(char[] name) {
return accessor;
}
public void computeRecordComponents() {
- if (!this.isRecordDeclaration || this.implicitComponentFields != null)
+ if (!this.isRecord() || this.implicitComponentFields != null)
return;
- RecordComponent[] recComps = this.scope.referenceContext.recordComponents;
+ List<String> recordComponentNames = Stream.of(this.components)
+ .map(arg -> new String(arg.name))
+ .collect(Collectors.toList());
List<FieldBinding> list = new ArrayList<>();
- if (recComps != null && recComps.length > 0 && this.fields != null) {
- List<String> recordComponentNames = new ArrayList<>(0);
- recordComponentNames = Arrays.stream(recComps)
- .map(arg -> new String(arg.name))
- .collect(Collectors.toList());
+ if (recordComponentNames != null && recordComponentNames.size() > 0 && this.fields != null) {
for (String rc : recordComponentNames) {
for (FieldBinding f : this.fields) {
if (rc.equals(new String(f.name))) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java
index 53cece980a..3104ee8495 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java
@@ -469,7 +469,7 @@ public class SyntheticMethodBinding extends MethodBinding {
SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass;
assert declaringSourceType.isRecord();
this.declaringClass = declaringSourceType;
- this.modifiers = ClassFileConstants.AccPublic;
+ this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccFinal;
if (this.declaringClass.isStrictfp())
this.modifiers |= ClassFileConstants.AccStrictfp;
this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
@@ -480,12 +480,10 @@ public class SyntheticMethodBinding extends MethodBinding {
this.parameters = Binding.NO_PARAMETERS;
this.purpose = SyntheticMethodBinding.RecordOverrideToString;
} else if (selector == TypeConstants.HASHCODE) {
- this.modifiers |= ClassFileConstants.AccFinal;
this.returnType = TypeBinding.INT;
this.parameters = Binding.NO_PARAMETERS;
this.purpose = SyntheticMethodBinding.RecordOverrideHashCode;
} else if (selector == TypeConstants.EQUALS) {
- this.modifiers |= ClassFileConstants.AccFinal;
this.returnType = TypeBinding.BOOLEAN;
this.parameters = new TypeBinding[] {declaringSourceType.scope.getJavaLangObject()};
this.purpose = SyntheticMethodBinding.RecordOverrideEquals;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
index 800ec93250..b85a71bf4f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1722,6 +1722,10 @@ public ReferenceBinding superclass() {
return null;
}
+public ReferenceBinding[] permittedTypes() {
+ return Binding.NO_PERMITTEDTYPES;
+}
+
public ReferenceBinding[] superInterfaces() {
return Binding.NO_SUPERINTERFACES;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index 9053c23bb0..1dd1f4f325 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -120,6 +120,9 @@ public interface TypeConstants {
// JEP 359 Records
char[] RECORD_RESTRICTED_IDENTIFIER = "record".toCharArray(); //$NON-NLS-1$
char[] RECORD_CLASS = "Record".toCharArray(); //$NON-NLS-1$
+ // JEP 360 Sealed
+ char[] PERMITS = "permits".toCharArray(); //$NON-NLS-1$
+ char[] SEALED = "sealed".toCharArray(); //$NON-NLS-1$
// jsr308
char[] TYPE_USE_TARGET = "TYPE_USE".toCharArray(); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
index a56d61af06..69f9da09f4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
@@ -65,3 +65,9 @@ ast_missingCode = Missing code gen implementation
### constant
constant_cannotCastedInto = {0} constant cannot be casted into {1}
constant_cannotConvertedTo = {0} constant cannot be converted to {1}
+
+### Java Language Features
+text_block = Text Blocks
+pattern_matching_instanceof = Pattern Matching in instanceof Expressions
+records = Records
+sealed_types = Sealed Types
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
index 436943cb79..26dc831e3a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -485,6 +485,7 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
protected Object createReturnStatement() { return null; }
protected abstract void createTag();
protected abstract Object createTypeReference(int primitiveToken);
+ protected abstract Object createModuleTypeReference(int primitiveToken, int moduleRefTokenCount);
private int getIndexPosition() {
if (this.index > this.lineEnd) {
@@ -1066,10 +1067,19 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
}
}
+ private boolean isTokenModule(int token, int moduleRefTokenCount) {
+ return ((token == TerminalTokens.TokenNameDIVIDE)
+ && (moduleRefTokenCount > 0));
+ }
+
+ protected Object parseQualifiedName(boolean reset) throws InvalidInputException {
+ return parseQualifiedName(reset, false);
+ }
+
/*
* Parse a qualified name and built a type reference if the syntax is valid.
*/
- protected Object parseQualifiedName(boolean reset) throws InvalidInputException {
+ protected Object parseQualifiedName(boolean reset, boolean allowModule) throws InvalidInputException {
// Reset identifier stack if requested
if (reset) {
@@ -1080,8 +1090,20 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
// Scan tokens
int primitiveToken = -1;
int parserKind = this.kind & PARSER_KIND;
+ int prevToken = TerminalTokens.TokenNameNotAToken;
+ int curToken = TerminalTokens.TokenNameNotAToken;
+ int moduleRefTokenCount = 0;
+ boolean lookForModule = false;
+ boolean parsingJava15Plus = this.scanner != null ? this.scanner.sourceLevel >= ClassFileConstants.JDK15 : false;
nextToken : for (int iToken = 0; ; iToken++) {
+ if (iToken == 0) {
+ lookForModule = false;
+ prevToken = TerminalTokens.TokenNameNotAToken;
+ } else {
+ prevToken = curToken;
+ }
int token = readTokenSafely();
+ curToken= token;
switch (token) {
case TerminalTokens.TokenNameIdentifier :
if (((iToken & 1) != 0)) { // identifiers must be odd tokens
@@ -1089,6 +1111,9 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
}
pushIdentifier(iToken == 0, false);
consumeToken();
+ if (allowModule && parsingJava15Plus && getChar() == '/') {
+ lookForModule = true;
+ }
break;
case TerminalTokens.TokenNameRestrictedIdentifierYield:
@@ -1130,11 +1155,14 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
case TerminalTokens.TokenNamelong:
case TerminalTokens.TokenNamenative:
case TerminalTokens.TokenNamenew:
+ case TerminalTokens.TokenNamenon_sealed:
case TerminalTokens.TokenNamenull:
case TerminalTokens.TokenNamepackage:
+ case TerminalTokens.TokenNameRestrictedIdentifierpermits:
case TerminalTokens.TokenNameprivate:
case TerminalTokens.TokenNameprotected:
case TerminalTokens.TokenNamepublic:
+ case TerminalTokens.TokenNameRestrictedIdentifiersealed:
case TerminalTokens.TokenNameshort:
case TerminalTokens.TokenNamestatic:
case TerminalTokens.TokenNamestrictfp:
@@ -1157,6 +1185,18 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
}
// Fall through default case to verify that we do not leave on a dot
//$FALL-THROUGH$
+ case TerminalTokens.TokenNameDIVIDE:
+ if (parsingJava15Plus && lookForModule) {
+ if (((iToken & 1) == 0) || (moduleRefTokenCount > 0)) { // '/' must be even token
+ throw new InvalidInputException();
+ }
+ moduleRefTokenCount = (iToken+1) / 2;
+ consumeToken();
+ lookForModule = false;
+ break;
+ } // else fall through
+ // Note: Add other cases before this case.
+ //$FALL-THROUGH$
default :
if (iToken == 0) {
if (this.identifierPtr>=0) {
@@ -1164,12 +1204,15 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
}
return null;
}
- if ((iToken & 1) == 0) { // cannot leave on a dot
+ if ((iToken & 1) == 0 && !isTokenModule(prevToken, moduleRefTokenCount)) { // cannot leave on a dot
switch (parserKind) {
case COMPLETION_PARSER:
if (this.identifierPtr>=0) {
this.lastIdentifierEndPosition = (int) this.identifierPositionStack[this.identifierPtr];
}
+ if (moduleRefTokenCount > 0) {
+ return syntaxRecoverModuleQualifiedName(primitiveToken, moduleRefTokenCount);
+ }
return syntaxRecoverQualifiedName(primitiveToken);
case DOM_PARSER:
if (this.currentTokenType != -1) {
@@ -1195,13 +1238,20 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
if (this.identifierPtr>=0) {
this.lastIdentifierEndPosition = (int) this.identifierPositionStack[this.identifierPtr];
}
+ if (moduleRefTokenCount > 0) {
+ return createModuleTypeReference(primitiveToken, moduleRefTokenCount);
+ }
return createTypeReference(primitiveToken);
}
+ protected boolean parseReference() throws InvalidInputException {
+ return parseReference(false);
+ }
+
/*
* Parse a reference in @see tag
*/
- protected boolean parseReference() throws InvalidInputException {
+ protected boolean parseReference(boolean allowModule) throws InvalidInputException {
int currentPosition = this.scanner.currentPosition;
try {
Object typeRef = null;
@@ -1291,7 +1341,7 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
case TerminalTokens.TokenNameIdentifier :
if (typeRef == null) {
typeRefStartPosition = this.scanner.getCurrentTokenStartPosition();
- typeRef = parseQualifiedName(true);
+ typeRef = parseQualifiedName(true, allowModule);
if (this.abort) return false; // May be aborted by specialized parser
break;
}
@@ -1546,6 +1596,32 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
}
/*
+ * get current character.
+ * Warning: scanner position is unchanged using this method!
+ */
+ private char getChar() {
+ int indexVal = this.index;
+ char c = this.source[indexVal++];
+ if (c == '\\' && this.source[indexVal] == 'u') {
+ int c1, c2, c3, c4;
+ int pos = indexVal;
+ indexVal++;
+ while (this.source[indexVal] == 'u')
+ indexVal++;
+ if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[indexVal++])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(this.source[indexVal++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(this.source[indexVal++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(this.source[indexVal++])) > 15 || c4 < 0))) {
+ c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+ } else {
+ // TODO (frederic) currently reset to previous position, perhaps signal a syntax error would be more appropriate
+ indexVal = pos;
+ }
+ }
+ return c;
+ }
+
+ /*
* Read token only if previous was consumed
*/
protected int readToken() throws InvalidInputException {
@@ -1629,6 +1705,14 @@ public abstract class AbstractCommentParser implements JavadocTagConstants {
return null;
}
+ /*
+ * Entry point for recovery on invalid syntax
+ */
+ protected Object syntaxRecoverModuleQualifiedName(int primitiveToken, int moduleTokenCount) throws InvalidInputException {
+ // do nothing, just an entry point for recovery
+ return null;
+ }
+
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
index 388eb092c6..98673749f4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,6 +28,7 @@ import org.eclipse.jdt.internal.compiler.ast.JavadocArraySingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocFieldReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend;
+import org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocReturnStatement;
import org.eclipse.jdt.internal.compiler.ast.JavadocSingleNameReference;
@@ -203,14 +204,24 @@ public class JavadocParser extends AbstractCommentParser {
protected Object createFieldReference(Object receiver) throws InvalidInputException {
try {
// Get receiver type
- TypeReference typeRef = (TypeReference) receiver;
+ TypeReference typeRef = null;
+ boolean useReceiver = false;
+ if (receiver instanceof JavadocModuleReference) {
+ JavadocModuleReference jRef = (JavadocModuleReference)receiver;
+ if (jRef.typeReference != null) {
+ typeRef = jRef.typeReference;
+ useReceiver = true;
+ }
+ } else {
+ typeRef = (TypeReference) receiver;
+ }
if (typeRef == null) {
char[] name = this.sourceParser.compilationUnit.getMainTypeName();
typeRef = new JavadocImplicitTypeReference(name, this.memberStart);
}
// Create field
JavadocFieldReference field = new JavadocFieldReference(this.identifierStack[0], this.identifierPositionStack[0]);
- field.receiver = typeRef;
+ field.receiver = useReceiver ? (Expression)receiver : typeRef;
field.tagSourceStart = this.tagSourceStart;
field.tagSourceEnd = this.tagSourceEnd;
field.tagValue = this.tagValue;
@@ -225,7 +236,15 @@ public class JavadocParser extends AbstractCommentParser {
protected Object createMethodReference(Object receiver, List arguments) throws InvalidInputException {
try {
// Get receiver type
- TypeReference typeRef = (TypeReference) receiver;
+ TypeReference typeRef = null;
+ if (receiver instanceof JavadocModuleReference) {
+ JavadocModuleReference jRef = (JavadocModuleReference)receiver;
+ if (jRef.typeReference != null) {
+ typeRef = jRef.typeReference;
+ }
+ } else {
+ typeRef = (TypeReference) receiver;
+ }
// Decide whether we have a constructor or not
boolean isConstructor = false;
int length = this.identifierLengthStack[0]; // may be > 1 for member class constructor reference
@@ -347,6 +366,43 @@ public class JavadocParser extends AbstractCommentParser {
return typeRef;
}
+ protected JavadocModuleReference createModuleReference(int moduleRefTokenCount) {
+ JavadocModuleReference moduleRef = null;
+ char[][] tokens = new char[moduleRefTokenCount][];
+ System.arraycopy(this.identifierStack, 0, tokens, 0, moduleRefTokenCount);
+ long[] positions = new long[moduleRefTokenCount];
+ System.arraycopy(this.identifierPositionStack, 0, positions, 0, moduleRefTokenCount);
+ moduleRef = new JavadocModuleReference(tokens, positions, this.tagSourceStart, this.tagSourceEnd);
+ return moduleRef;
+ }
+
+ @Override
+ protected Object createModuleTypeReference(int primitiveToken, int moduleRefTokenCount) {
+ JavadocModuleReference moduleRef= createModuleReference(moduleRefTokenCount);
+
+ TypeReference typeRef = null;
+ int size = this.identifierLengthStack[this.identifierLengthPtr];
+ int newSize= size-moduleRefTokenCount;
+ if (newSize == 1) { // Single Type ref
+ typeRef = new JavadocSingleTypeReference(
+ this.identifierStack[this.identifierPtr],
+ this.identifierPositionStack[this.identifierPtr],
+ this.tagSourceStart,
+ this.tagSourceEnd);
+ } else if (newSize > 1) { // Qualified Type ref
+ char[][] tokens = new char[newSize][];
+ System.arraycopy(this.identifierStack, this.identifierPtr - newSize + 1, tokens, 0, newSize);
+ long[] positions = new long[newSize];
+ System.arraycopy(this.identifierPositionStack, this.identifierPtr - newSize + 1, positions, 0, newSize);
+ typeRef = new JavadocQualifiedTypeReference(tokens, positions, this.tagSourceStart, this.tagSourceEnd);
+ } else {
+ this.lastIdentifierEndPosition++;
+ }
+
+ moduleRef.setTypeReference(typeRef);
+ return moduleRef;
+ }
+
/*
* Get current parsed type declaration.
*/
@@ -626,12 +682,12 @@ public class JavadocParser extends AbstractCommentParser {
if (length == TAG_LINK_LENGTH && CharOperation.equals(TAG_LINK, tagName, 0, length)) {
this.tagValue = TAG_LINK_VALUE;
if (this.inlineTagStarted || (this.kind & COMPLETION_PARSER) != 0) {
- valid= parseReference();
+ valid= parseReference(true);
}
} else if (length == TAG_LINKPLAIN_LENGTH && CharOperation.equals(TAG_LINKPLAIN, tagName, 0, length)) {
this.tagValue = TAG_LINKPLAIN_VALUE;
if (this.inlineTagStarted) {
- valid = parseReference();
+ valid = parseReference(true);
}
} else if (length == TAG_LITERAL_LENGTH && this.inlineTagStarted && CharOperation.equals(TAG_LITERAL, tagName, 0, length)) {
this.tagValue = TAG_LITERAL_VALUE;
@@ -663,7 +719,7 @@ public class JavadocParser extends AbstractCommentParser {
if (length == TAG_SEE_LENGTH && CharOperation.equals(TAG_SEE, tagName, 0, length)) {
this.tagValue = TAG_SEE_VALUE;
if (!this.inlineTagStarted) {
- valid = parseReference();
+ valid = parseReference(true);
}
} else if (length == TAG_SERIAL_LENGTH && CharOperation.equals(TAG_SERIAL, tagName, 0, length)) {
this.tagValue = TAG_SERIAL_VALUE;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
index 19360cdbc4..7e9c736a09 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -198,6 +198,8 @@ public interface JavadocTagConstants {
//since 13
{},
//since 14
+ {},
+ //since 15
{}
};
public static final char[][][] INLINE_TAGS = {
@@ -230,6 +232,8 @@ public interface JavadocTagConstants {
//since 13
{},
//since 14
+ {},
+ //since 15
{}
};
public final static int INLINE_TAGS_LENGTH = INLINE_TAGS.length;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 6ee5aa96fa..e89e50d32e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -57,7 +57,7 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
+import org.eclipse.jdt.internal.compiler.impl.JavaFeature;
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
@@ -229,6 +229,8 @@ public class Parser implements TerminalTokens, ParserBasicInformation, Conflicte
compliance = ClassFileConstants.JDK13;
} else if("14".equals(token)) { //$NON-NLS-1$
compliance = ClassFileConstants.JDK14;
+ } else if("15".equals(token)) { //$NON-NLS-1$
+ compliance = ClassFileConstants.JDK15;
} else if("recovery".equals(token)) { //$NON-NLS-1$
compliance = ClassFileConstants.JDK_DEFERRED;
}
@@ -966,6 +968,8 @@ private int stateStackLengthStack[] = new int[0];
protected boolean parsingJava8Plus;
protected boolean parsingJava9Plus;
protected boolean parsingJava14Plus;
+protected boolean parsingJava15Plus;
+protected boolean previewEnabled;
protected boolean parsingJava11Plus;
protected int unstackedAct = ERROR_ACTION;
private boolean haltOnSyntaxError = false;
@@ -987,8 +991,10 @@ public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) {
initializeScanner();
this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8;
this.parsingJava9Plus = this.options.sourceLevel >= ClassFileConstants.JDK9;
- this.parsingJava14Plus = this.options.sourceLevel >= ClassFileConstants.JDK14;
this.parsingJava11Plus = this.options.sourceLevel >= ClassFileConstants.JDK11;
+ this.parsingJava14Plus = this.options.sourceLevel >= ClassFileConstants.JDK14;
+ this.parsingJava15Plus = this.options.sourceLevel >= ClassFileConstants.JDK15;
+ this.previewEnabled = this.options.sourceLevel == ClassFileConstants.getLatestJDKLevel() && this.options.enablePreviewFeatures;
this.astLengthStack = new int[50];
this.patternLengthStack = new int[20];
this.expressionLengthStack = new int[30];
@@ -1216,6 +1222,10 @@ protected void checkAndSetModifiers(int flag){
if (this.currentElement != null) {
this.currentElement.addModifier(flag, this.modifiersSourceStart);
}
+ if (flag == ExtraCompilerModifiers.AccSealed || flag == ExtraCompilerModifiers.AccNonSealed) {
+ problemReporter().validateJavaFeatureSupport(JavaFeature.SEALED_CLASSES, this.scanner.startPosition,
+ this.scanner.currentPosition - 1);
+ }
}
public void checkComment() {
@@ -2265,6 +2275,7 @@ protected void consumeCaseLabel() {
}
this.casePtr--;
this.scanner.caseStartPosition = this.casePtr >= 0 ? this.caseStack[this.casePtr] : -1;
+
pushOnAstStack(caseStatement);
}
protected void consumeCastExpressionLL1() {
@@ -2681,7 +2692,9 @@ private void consumeClassOrRecordHeaderName1(boolean isRecord) {
// we want to keep the beginning position but get rid of the end position
// it is only used for the ClassLiteralAccess positions.
typeDecl.declarationSourceStart = this.intStack[this.intPtr--];
- typeDecl.restrictedIdentifierStart = typeDecl.declarationSourceStart;
+ if (isRecord) {
+ typeDecl.restrictedIdentifierStart = typeDecl.declarationSourceStart;
+ }
this.intPtr--; // remove the end position of the class token
typeDecl.modifiersSourceStart = this.intStack[this.intPtr--];
@@ -2728,6 +2741,9 @@ protected void consumeClassHeaderName1() {
// ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier'
consumeClassOrRecordHeaderName1(false);
}
+protected void consumeClassHeaderPermittedSubclasses() {
+populatePermittedTypes();
+}
protected void consumeClassInstanceCreationExpression() {
// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
classInstanceCreation(false);
@@ -4531,15 +4547,7 @@ private void consumeTypeTestPattern() {
type = getTypeReference(this.intStack[this.intPtr--]); //getTypeReference(0); // no type dimension
local.declarationSourceStart = type.sourceStart;
local.type = type;
- if (!this.parsingJava14Plus) {
- problemReporter().previewFeatureNotSupported(type.sourceStart, local.declarationEnd, "Instanceof Pattern", CompilerOptions.VERSION_13); //$NON-NLS-1$
- } else if (!this.options.enablePreviewFeatures){
- problemReporter().previewFeatureNotEnabled(type.sourceStart, local.declarationEnd, "Instanceof Pattern"); //$NON-NLS-1$
- } else {
- if (this.options.isAnyEnabled(IrritantSet.PREVIEW)) {
- problemReporter().previewFeatureUsed(type.sourceStart, local.declarationEnd);
- }
- }
+ problemReporter().validateJavaFeatureSupport(JavaFeature.PATTERN_MATCHING_IN_INSTANCEOF, type.sourceStart, local.declarationEnd);
local.modifiers |= ClassFileConstants.AccFinal;
pushOnPatternStack(local);
}
@@ -4738,6 +4746,35 @@ protected void consumeInterfaceHeaderName1() {
typeDecl.javadoc = this.javadoc;
this.javadoc = null;
}
+protected void consumeInterfaceHeaderPermittedSubClassesAndSubInterfaces() {
+ // InterfaceHeaderPermittedSubClassesAndSubInterfaces ::= RestrictedIdentifierpermits ClassTypeList
+ populatePermittedTypes();
+}
+private void populatePermittedTypes() {
+ int length = this.astLengthStack[this.astLengthPtr--];
+ //permitted types
+ this.astPtr -= length;
+ TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
+ typeDecl.restrictedIdentifierStart= this.intStack[this.intPtr--];
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + 1,
+ typeDecl.permittedTypes = new TypeReference[length],
+ 0,
+ length);
+ TypeReference[] permittedTypes = typeDecl.permittedTypes;
+ for (int i = 0, max = permittedTypes.length; i < max; i++) {
+ TypeReference typeReference = permittedTypes[i];
+ typeDecl.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations); // TODO: Confirm with spec
+// typeReference.bits |= ASTNode.IsSuperType; // TODO: Check equivalent required
+ }
+ typeDecl.bodyStart = typeDecl.permittedTypes[length-1].sourceEnd + 1;
+ this.listLength = 0; // reset after having read super-interfaces
+ // recovery
+ if (this.currentElement != null) {
+ this.lastCheckPoint = typeDecl.bodyStart;
+ }
+}
protected void consumeInterfaceMemberDeclarations() {
// InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
concatNodeLists();
@@ -4840,6 +4877,13 @@ protected void consumeInvalidConstructorDeclaration(boolean hasBody) {
}
protected void consumeInvalidEnumDeclaration() {
// BlockStatement ::= EnumDeclaration
+ if (this.previewEnabled) {
+ /* JLS 15 Local Static Interfaces and Enum Classes - Records preview - Sec 6.1
+ * A local class or interface (14.3), declared in one of the following: A class declaration, An enum declaration,
+ * An interface declaration
+ */
+ return;
+ }
TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
if(!this.statementRecoveryActivated) problemReporter().illegalLocalTypeDeclaration(typeDecl);
// remove the ast node created in interface header
@@ -4850,6 +4894,13 @@ protected void consumeInvalidEnumDeclaration() {
protected void consumeInvalidInterfaceDeclaration() {
// BlockStatement ::= InvalidInterfaceDeclaration
//InterfaceDeclaration ::= Modifiersopt 'interface' 'Identifier' ExtendsInterfacesopt InterfaceHeader InterfaceBody
+ if (this.previewEnabled) {
+ /* JLS 15 Local Static Interfaces and Enum Classes - Records preview - Sec 6.1
+ * A local class or interface (14.3), declared in one of the following: A class declaration, An enum declaration,
+ * An interface declaration
+ */
+ return;
+ }
TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
if(!this.statementRecoveryActivated) problemReporter().illegalLocalTypeDeclaration(typeDecl);
// remove the ast node created in interface header
@@ -6613,2202 +6664,2210 @@ protected void consumeZeroTypeAnnotations() {
// This method is part of an automatic generation : do NOT edit-modify
protected void consumeRule(int act) {
switch ( act ) {
- case 38 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$
+ case 40 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$
consumePrimitiveType();
break;
- case 52 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
+ case 54 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
consumeReferenceType();
break;
- case 56 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$
+ case 58 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$
consumeClassOrInterfaceName();
break;
- case 57 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$
+ case 59 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$
consumeClassOrInterface();
break;
- case 58 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$
+ case 60 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$
consumeGenericType();
break;
- case 59 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$
+ case 61 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$
consumeGenericTypeWithDiamond();
break;
- case 60 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); } //$NON-NLS-1$
+ case 62 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); } //$NON-NLS-1$
consumeArrayTypeWithTypeArgumentsName();
break;
- case 61 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$
+ case 63 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$
consumePrimitiveArrayType();
break;
- case 62 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$
+ case 64 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$
consumeNameArrayType();
break;
- case 63 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$
+ case 65 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$
consumeGenericTypeNameArrayType();
break;
- case 64 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$
+ case 66 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$
consumeGenericTypeArrayType();
break;
- case 66 : if (DEBUG) { System.out.println("Name ::= SimpleName"); } //$NON-NLS-1$
+ case 68 : if (DEBUG) { System.out.println("Name ::= SimpleName"); } //$NON-NLS-1$
consumeZeroTypeAnnotations();
break;
- case 71 : if (DEBUG) { System.out.println("UnannotatableName ::= UnannotatableName DOT SimpleName"); } //$NON-NLS-1$
+ case 73 : if (DEBUG) { System.out.println("UnannotatableName ::= UnannotatableName DOT SimpleName"); } //$NON-NLS-1$
consumeUnannotatableQualifiedName();
break;
- case 72 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$
+ case 74 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$
consumeQualifiedName(false);
break;
- case 73 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT TypeAnnotations SimpleName"); } //$NON-NLS-1$
+ case 75 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT TypeAnnotations SimpleName"); } //$NON-NLS-1$
consumeQualifiedName(true);
break;
- case 74 : if (DEBUG) { System.out.println("TypeAnnotationsopt ::="); } //$NON-NLS-1$
+ case 76 : if (DEBUG) { System.out.println("TypeAnnotationsopt ::="); } //$NON-NLS-1$
consumeZeroTypeAnnotations();
break;
- case 78 : if (DEBUG) { System.out.println("TypeAnnotations0 ::= TypeAnnotations0 TypeAnnotation"); } //$NON-NLS-1$
+ case 80 : if (DEBUG) { System.out.println("TypeAnnotations0 ::= TypeAnnotations0 TypeAnnotation"); } //$NON-NLS-1$
consumeOneMoreTypeAnnotation();
break;
- case 79 : if (DEBUG) { System.out.println("TypeAnnotation ::= NormalTypeAnnotation"); } //$NON-NLS-1$
+ case 81 : if (DEBUG) { System.out.println("TypeAnnotation ::= NormalTypeAnnotation"); } //$NON-NLS-1$
consumeTypeAnnotation();
break;
- case 80 : if (DEBUG) { System.out.println("TypeAnnotation ::= MarkerTypeAnnotation"); } //$NON-NLS-1$
+ case 82 : if (DEBUG) { System.out.println("TypeAnnotation ::= MarkerTypeAnnotation"); } //$NON-NLS-1$
consumeTypeAnnotation();
break;
- case 81 : if (DEBUG) { System.out.println("TypeAnnotation ::= SingleMemberTypeAnnotation"); } //$NON-NLS-1$
+ case 83 : if (DEBUG) { System.out.println("TypeAnnotation ::= SingleMemberTypeAnnotation"); } //$NON-NLS-1$
consumeTypeAnnotation();
break;
- case 82 : if (DEBUG) { System.out.println("TypeAnnotationName ::= AT308 UnannotatableName"); } //$NON-NLS-1$
+ case 84 : if (DEBUG) { System.out.println("TypeAnnotationName ::= AT308 UnannotatableName"); } //$NON-NLS-1$
consumeAnnotationName() ;
break;
- case 83 : if (DEBUG) { System.out.println("NormalTypeAnnotation ::= TypeAnnotationName LPAREN..."); } //$NON-NLS-1$
+ case 85 : if (DEBUG) { System.out.println("NormalTypeAnnotation ::= TypeAnnotationName LPAREN..."); } //$NON-NLS-1$
consumeNormalAnnotation(true) ;
break;
- case 84 : if (DEBUG) { System.out.println("MarkerTypeAnnotation ::= TypeAnnotationName"); } //$NON-NLS-1$
+ case 86 : if (DEBUG) { System.out.println("MarkerTypeAnnotation ::= TypeAnnotationName"); } //$NON-NLS-1$
consumeMarkerAnnotation(true) ;
break;
- case 85 : if (DEBUG) { System.out.println("SingleMemberTypeAnnotation ::= TypeAnnotationName LPAREN"); } //$NON-NLS-1$
+ case 87 : if (DEBUG) { System.out.println("SingleMemberTypeAnnotation ::= TypeAnnotationName LPAREN"); } //$NON-NLS-1$
consumeSingleMemberAnnotation(true) ;
break;
- case 86 : if (DEBUG) { System.out.println("RejectTypeAnnotations ::="); } //$NON-NLS-1$
+ case 88 : if (DEBUG) { System.out.println("RejectTypeAnnotations ::="); } //$NON-NLS-1$
consumeNonTypeUseName();
break;
- case 87 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$
+ case 89 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$
consumeZeroTypeAnnotations();
break;
- case 88 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= this"); } //$NON-NLS-1$
+ case 90 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= this"); } //$NON-NLS-1$
consumeExplicitThisParameter(false);
break;
- case 89 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= UnannotatableName DOT this"); } //$NON-NLS-1$
+ case 91 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= UnannotatableName DOT this"); } //$NON-NLS-1$
consumeExplicitThisParameter(true);
break;
- case 90 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= VariableDeclaratorId"); } //$NON-NLS-1$
+ case 92 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= VariableDeclaratorId"); } //$NON-NLS-1$
consumeVariableDeclaratorIdParameter();
break;
- case 91 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$
+ case 93 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$
consumeCompilationUnit();
break;
- case 92 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$
+ case 94 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$
consumeInternalCompilationUnit();
break;
- case 93 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ case 95 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
consumeInternalCompilationUnit();
break;
- case 94 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ case 96 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 95 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ case 97 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 96 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 98 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeInternalCompilationUnit();
break;
- case 97 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$
+ case 99 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 98 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 100 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 99 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$
+ case 101 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$
consumeEmptyInternalCompilationUnit();
break;
- case 100 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 102 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithModuleDeclaration();
break;
- case 101 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ModuleDeclaration"); } //$NON-NLS-1$
+ case 103 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ModuleDeclaration"); } //$NON-NLS-1$
consumeInternalCompilationUnitWithModuleDeclaration();
break;
- case 102 : if (DEBUG) { System.out.println("ModuleDeclaration ::= ModuleHeader ModuleBody"); } //$NON-NLS-1$
+ case 104 : if (DEBUG) { System.out.println("ModuleDeclaration ::= ModuleHeader ModuleBody"); } //$NON-NLS-1$
consumeModuleDeclaration();
break;
- case 103 : if (DEBUG) { System.out.println("ModuleHeader ::= Modifiersopt ModuleModifieropt module"); } //$NON-NLS-1$
+ case 105 : if (DEBUG) { System.out.println("ModuleHeader ::= Modifiersopt ModuleModifieropt module"); } //$NON-NLS-1$
consumeModuleHeader();
break;
- case 105 : if (DEBUG) { System.out.println("ModuleModifieropt ::= ModuleModifier"); } //$NON-NLS-1$
+ case 107 : if (DEBUG) { System.out.println("ModuleModifieropt ::= ModuleModifier"); } //$NON-NLS-1$
consumeModuleModifiers();
break;
- case 108 : if (DEBUG) { System.out.println("ModuleStatementsOpt ::="); } //$NON-NLS-1$
+ case 110 : if (DEBUG) { System.out.println("ModuleStatementsOpt ::="); } //$NON-NLS-1$
consumeEmptyModuleStatementsOpt();
break;
- case 111 : if (DEBUG) { System.out.println("ModuleStatements ::= ModuleStatements ModuleStatement"); } //$NON-NLS-1$
+ case 113 : if (DEBUG) { System.out.println("ModuleStatements ::= ModuleStatements ModuleStatement"); } //$NON-NLS-1$
consumeModuleStatements();
break;
- case 117 : if (DEBUG) { System.out.println("RequiresStatement ::= SingleRequiresModuleName SEMICOLON"); } //$NON-NLS-1$
+ case 119 : if (DEBUG) { System.out.println("RequiresStatement ::= SingleRequiresModuleName SEMICOLON"); } //$NON-NLS-1$
consumeRequiresStatement();
break;
- case 118 : if (DEBUG) { System.out.println("SingleRequiresModuleName ::= requires..."); } //$NON-NLS-1$
+ case 120 : if (DEBUG) { System.out.println("SingleRequiresModuleName ::= requires..."); } //$NON-NLS-1$
consumeSingleRequiresModuleName();
break;
- case 119 : if (DEBUG) { System.out.println("RequiresModifiersopt ::= RequiresModifiers"); } //$NON-NLS-1$
+ case 121 : if (DEBUG) { System.out.println("RequiresModifiersopt ::= RequiresModifiers"); } //$NON-NLS-1$
consumeModifiers();
break;
- case 120 : if (DEBUG) { System.out.println("RequiresModifiersopt ::="); } //$NON-NLS-1$
+ case 122 : if (DEBUG) { System.out.println("RequiresModifiersopt ::="); } //$NON-NLS-1$
consumeDefaultModifiers();
break;
- case 122 : if (DEBUG) { System.out.println("RequiresModifiers ::= RequiresModifiers RequiresModifier"); } //$NON-NLS-1$
+ case 124 : if (DEBUG) { System.out.println("RequiresModifiers ::= RequiresModifiers RequiresModifier"); } //$NON-NLS-1$
consumeModifiers2();
break;
- case 125 : if (DEBUG) { System.out.println("ExportsStatement ::= ExportsHeader TargetModuleListopt"); } //$NON-NLS-1$
+ case 127 : if (DEBUG) { System.out.println("ExportsStatement ::= ExportsHeader TargetModuleListopt"); } //$NON-NLS-1$
consumeExportsStatement();
break;
- case 126 : if (DEBUG) { System.out.println("ExportsHeader ::= exports SinglePkgName"); } //$NON-NLS-1$
+ case 128 : if (DEBUG) { System.out.println("ExportsHeader ::= exports SinglePkgName"); } //$NON-NLS-1$
consumeExportsHeader();
break;
- case 128 : if (DEBUG) { System.out.println("TargetModuleListopt ::= to TargetModuleNameList"); } //$NON-NLS-1$
+ case 130 : if (DEBUG) { System.out.println("TargetModuleListopt ::= to TargetModuleNameList"); } //$NON-NLS-1$
consumeTargetModuleList();
break;
- case 129 : if (DEBUG) { System.out.println("TargetModuleName ::= UnannotatableName"); } //$NON-NLS-1$
+ case 131 : if (DEBUG) { System.out.println("TargetModuleName ::= UnannotatableName"); } //$NON-NLS-1$
consumeSingleTargetModuleName();
break;
- case 131 : if (DEBUG) { System.out.println("TargetModuleNameList ::= TargetModuleNameList COMMA..."); } //$NON-NLS-1$
+ case 133 : if (DEBUG) { System.out.println("TargetModuleNameList ::= TargetModuleNameList COMMA..."); } //$NON-NLS-1$
consumeTargetModuleNameList();
break;
- case 132 : if (DEBUG) { System.out.println("SinglePkgName ::= UnannotatableName"); } //$NON-NLS-1$
+ case 134 : if (DEBUG) { System.out.println("SinglePkgName ::= UnannotatableName"); } //$NON-NLS-1$
consumeSinglePkgName();
break;
- case 133 : if (DEBUG) { System.out.println("OpensStatement ::= OpensHeader TargetModuleListopt..."); } //$NON-NLS-1$
+ case 135 : if (DEBUG) { System.out.println("OpensStatement ::= OpensHeader TargetModuleListopt..."); } //$NON-NLS-1$
consumeOpensStatement();
break;
- case 134 : if (DEBUG) { System.out.println("OpensHeader ::= opens SinglePkgName"); } //$NON-NLS-1$
+ case 136 : if (DEBUG) { System.out.println("OpensHeader ::= opens SinglePkgName"); } //$NON-NLS-1$
consumeOpensHeader();
break;
- case 135 : if (DEBUG) { System.out.println("UsesStatement ::= UsesHeader SEMICOLON"); } //$NON-NLS-1$
+ case 137 : if (DEBUG) { System.out.println("UsesStatement ::= UsesHeader SEMICOLON"); } //$NON-NLS-1$
consumeUsesStatement();
break;
- case 136 : if (DEBUG) { System.out.println("UsesHeader ::= uses Name"); } //$NON-NLS-1$
+ case 138 : if (DEBUG) { System.out.println("UsesHeader ::= uses Name"); } //$NON-NLS-1$
consumeUsesHeader();
break;
- case 137 : if (DEBUG) { System.out.println("ProvidesStatement ::= ProvidesInterface WithClause..."); } //$NON-NLS-1$
+ case 139 : if (DEBUG) { System.out.println("ProvidesStatement ::= ProvidesInterface WithClause..."); } //$NON-NLS-1$
consumeProvidesStatement();
break;
- case 138 : if (DEBUG) { System.out.println("ProvidesInterface ::= provides Name"); } //$NON-NLS-1$
+ case 140 : if (DEBUG) { System.out.println("ProvidesInterface ::= provides Name"); } //$NON-NLS-1$
consumeProvidesInterface();
break;
- case 139 : if (DEBUG) { System.out.println("ServiceImplName ::= Name"); } //$NON-NLS-1$
+ case 141 : if (DEBUG) { System.out.println("ServiceImplName ::= Name"); } //$NON-NLS-1$
consumeSingleServiceImplName();
break;
- case 141 : if (DEBUG) { System.out.println("ServiceImplNameList ::= ServiceImplNameList COMMA..."); } //$NON-NLS-1$
+ case 143 : if (DEBUG) { System.out.println("ServiceImplNameList ::= ServiceImplNameList COMMA..."); } //$NON-NLS-1$
consumeServiceImplNameList();
break;
- case 142 : if (DEBUG) { System.out.println("WithClause ::= with ServiceImplNameList"); } //$NON-NLS-1$
+ case 144 : if (DEBUG) { System.out.println("WithClause ::= with ServiceImplNameList"); } //$NON-NLS-1$
consumeWithClause();
break;
- case 143 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$
+ case 145 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$
consumeReduceImports();
break;
- case 144 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$
+ case 146 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$
consumeEnterCompilationUnit();
break;
- case 167 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
+ case 169 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
consumeCatchHeader();
break;
- case 169 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 171 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeImportDeclarations();
break;
- case 171 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$
+ case 173 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$
consumeTypeDeclarations();
break;
- case 172 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$
+ case 174 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$
consumePackageDeclaration();
break;
- case 173 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$
+ case 175 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$
consumePackageDeclarationNameWithModifiers();
break;
- case 174 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$
+ case 176 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$
consumePackageDeclarationName();
break;
- case 175 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$
+ case 177 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$
consumePackageComment();
break;
- case 180 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$
+ case 182 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 181 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name..."); } //$NON-NLS-1$
+ case 183 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name..."); } //$NON-NLS-1$
consumeSingleTypeImportDeclarationName();
break;
- case 182 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
+ case 184 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 183 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$
+ case 185 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$
consumeTypeImportOnDemandDeclarationName();
break;
- case 186 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ case 188 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyTypeDeclaration();
break;
- case 191 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$
+ case 193 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$
consumeModifiers2();
break;
- case 203 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$
+ case 207 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$
consumeAnnotationAsModifier();
break;
- case 204 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$
+ case 208 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$
consumeClassDeclaration();
break;
- case 205 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$
+ case 209 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$
consumeClassHeader();
break;
- case 206 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$
+ case 210 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$
consumeTypeHeaderNameWithTypeParameters();
break;
- case 208 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$
+ case 212 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$
consumeClassHeaderName1();
break;
- case 209 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$
+ case 213 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$
consumeClassHeaderExtends();
break;
- case 210 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$
+ case 214 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$
consumeClassHeaderImplements();
break;
- case 212 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$
+ case 216 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$
consumeInterfaceTypeList();
break;
- case 213 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
+ case 217 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
consumeInterfaceType();
break;
- case 216 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$
+ case 220 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$
consumeClassBodyDeclarations();
break;
- case 220 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$
+ case 224 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$
consumeClassBodyDeclaration();
break;
- case 221 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$
+ case 225 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$
consumeDiet();
break;
- case 222 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$
+ case 226 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$
consumeClassBodyDeclaration();
break;
- case 223 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$
+ case 227 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$
consumeCreateInitializer();
break;
- case 231 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ case 235 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyTypeDeclaration();
break;
- case 234 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 238 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeFieldDeclaration();
break;
- case 236 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$
+ case 240 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$
consumeVariableDeclarators();
break;
- case 239 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$
+ case 243 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$
consumeEnterVariable();
break;
- case 240 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$
+ case 244 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$
consumeExitVariableWithInitialization();
break;
- case 241 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$
+ case 245 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$
consumeExitVariableWithoutInitialization();
break;
- case 242 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$
+ case 246 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$
consumeForceNoDiet();
break;
- case 243 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$
+ case 247 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$
consumeRestoreDiet();
break;
- case 248 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
+ case 252 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
// set to true to consume a method with a body
consumeMethodDeclaration(true, false);
break;
- case 249 : if (DEBUG) { System.out.println("MethodDeclaration ::= DefaultMethodHeader MethodBody"); } //$NON-NLS-1$
+ case 253 : if (DEBUG) { System.out.println("MethodDeclaration ::= DefaultMethodHeader MethodBody"); } //$NON-NLS-1$
// set to true to consume a method with a body
consumeMethodDeclaration(true, true);
break;
- case 250 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$
+ case 254 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$
// set to false to consume a method without body
consumeMethodDeclaration(false, false);
break;
- case 251 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$
+ case 255 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 252 : if (DEBUG) { System.out.println("DefaultMethodHeader ::= DefaultMethodHeaderName..."); } //$NON-NLS-1$
+ case 256 : if (DEBUG) { System.out.println("DefaultMethodHeader ::= DefaultMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 253 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$
+ case 257 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$
consumeMethodHeaderNameWithTypeParameters(false);
break;
- case 254 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$
+ case 258 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$
consumeMethodHeaderName(false);
break;
- case 255 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
+ case 259 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
consumeMethodHeaderNameWithTypeParameters(false);
break;
- case 256 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault Type..."); } //$NON-NLS-1$
+ case 260 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault Type..."); } //$NON-NLS-1$
consumeMethodHeaderName(false);
break;
- case 257 : if (DEBUG) { System.out.println("ModifiersWithDefault ::= Modifiersopt default..."); } //$NON-NLS-1$
+ case 261 : if (DEBUG) { System.out.println("ModifiersWithDefault ::= Modifiersopt default..."); } //$NON-NLS-1$
consumePushCombineModifiers();
break;
- case 258 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
+ case 262 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
consumeMethodHeaderRightParen();
break;
- case 259 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$
+ case 263 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$
consumeMethodHeaderExtendedDims();
break;
- case 260 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$
+ case 264 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$
consumeMethodHeaderThrowsClause();
break;
- case 261 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$
+ case 265 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$
consumeConstructorHeader();
break;
- case 262 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$
+ case 266 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$
consumeConstructorHeaderNameWithTypeParameters();
break;
- case 263 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$
+ case 267 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$
consumeConstructorHeaderName();
break;
- case 265 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$
+ case 269 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$
consumeFormalParameterList();
break;
- case 266 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 270 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeFormalParameter(false);
break;
- case 267 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 271 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeFormalParameter(true);
break;
- case 268 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type AT308DOTDOTDOT..."); } //$NON-NLS-1$
+ case 272 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type AT308DOTDOTDOT..."); } //$NON-NLS-1$
consumeFormalParameter(true);
break;
- case 269 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$
+ case 273 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$
consumeCatchFormalParameter();
break;
- case 270 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$
+ case 274 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$
consumeCatchType();
break;
- case 271 : if (DEBUG) { System.out.println("UnionType ::= Type"); } //$NON-NLS-1$
+ case 275 : if (DEBUG) { System.out.println("UnionType ::= Type"); } //$NON-NLS-1$
consumeUnionTypeAsClassType();
break;
- case 272 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$
+ case 276 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$
consumeUnionType();
break;
- case 274 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$
+ case 278 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$
consumeClassTypeList();
break;
- case 275 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$
+ case 279 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$
consumeClassTypeElt();
break;
- case 276 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$
+ case 280 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$
consumeMethodBody();
break;
- case 277 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$
+ case 281 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$
consumeNestedMethod();
break;
- case 278 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$
+ case 282 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$
consumeStaticInitializer();
break;
- case 279 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$
+ case 283 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$
consumeStaticOnly();
break;
- case 280 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$
+ case 284 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$
consumeConstructorDeclaration() ;
break;
- case 281 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$
+ case 285 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$
consumeInvalidConstructorDeclaration() ;
break;
- case 282 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$
+ case 286 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(0, THIS_CALL);
break;
- case 283 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$
+ case 287 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL);
break;
- case 284 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$
+ case 288 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(0,SUPER_CALL);
break;
- case 285 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 289 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL);
break;
- case 286 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$
+ case 290 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(1, SUPER_CALL);
break;
- case 287 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
+ case 291 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL);
break;
- case 288 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$
+ case 292 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(2, SUPER_CALL);
break;
- case 289 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
+ case 293 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL);
break;
- case 290 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$
+ case 294 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(1, THIS_CALL);
break;
- case 291 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
+ case 295 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL);
break;
- case 292 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$
+ case 296 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(2, THIS_CALL);
break;
- case 293 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
+ case 297 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL);
break;
- case 294 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$
+ case 298 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$
consumeInterfaceDeclaration();
break;
- case 295 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$
+ case 299 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$
consumeInterfaceHeader();
break;
- case 296 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$
+ case 300 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$
consumeTypeHeaderNameWithTypeParameters();
break;
- case 298 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$
+ case 302 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$
consumeInterfaceHeaderName1();
break;
- case 299 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$
+ case 303 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$
consumeInterfaceHeaderExtends();
break;
- case 302 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$
+ case 306 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$
consumeInterfaceMemberDeclarations();
break;
- case 303 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ case 307 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyTypeDeclaration();
break;
- case 305 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
+ case 309 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
consumeInterfaceMethodDeclaration(false);
break;
- case 306 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
+ case 310 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
consumeInterfaceMethodDeclaration(false);
break;
- case 307 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
+ case 311 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
consumeInterfaceMethodDeclaration(true);
break;
- case 308 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
+ case 312 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
consumeInvalidConstructorDeclaration(true);
break;
- case 309 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
+ case 313 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
consumeInvalidConstructorDeclaration(false);
break;
- case 320 : if (DEBUG) { System.out.println("RecordDeclaration ::= RecordHeaderPart RecordBody"); } //$NON-NLS-1$
+ case 324 : if (DEBUG) { System.out.println("RecordDeclaration ::= RecordHeaderPart RecordBody"); } //$NON-NLS-1$
consumeRecordDeclaration();
break;
- case 321 : if (DEBUG) { System.out.println("RecordHeaderPart ::= RecordHeaderName RecordHeader..."); } //$NON-NLS-1$
+ case 325 : if (DEBUG) { System.out.println("RecordHeaderPart ::= RecordHeaderName RecordHeader..."); } //$NON-NLS-1$
consumeRecordHeaderPart();
break;
- case 322 : if (DEBUG) { System.out.println("RecordHeaderName ::= RecordHeaderName1 TypeParameters"); } //$NON-NLS-1$
+ case 326 : if (DEBUG) { System.out.println("RecordHeaderName ::= RecordHeaderName1 TypeParameters"); } //$NON-NLS-1$
consumeRecordHeaderNameWithTypeParameters();
break;
- case 324 : if (DEBUG) { System.out.println("RecordHeaderName1 ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 328 : if (DEBUG) { System.out.println("RecordHeaderName1 ::= Modifiersopt..."); } //$NON-NLS-1$
consumeRecordHeaderName1();
break;
- case 325 : if (DEBUG) { System.out.println("RecordComponentHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
+ case 329 : if (DEBUG) { System.out.println("RecordComponentHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
consumeRecordComponentHeaderRightParen();
break;
- case 326 : if (DEBUG) { System.out.println("RecordHeader ::= LPAREN RecordComponentsopt..."); } //$NON-NLS-1$
+ case 330 : if (DEBUG) { System.out.println("RecordHeader ::= LPAREN RecordComponentsopt..."); } //$NON-NLS-1$
consumeRecordHeader();
break;
- case 327 : if (DEBUG) { System.out.println("RecordComponentsopt ::="); } //$NON-NLS-1$
+ case 331 : if (DEBUG) { System.out.println("RecordComponentsopt ::="); } //$NON-NLS-1$
consumeRecordComponentsopt();
break;
- case 330 : if (DEBUG) { System.out.println("RecordComponents ::= RecordComponents COMMA..."); } //$NON-NLS-1$
+ case 334 : if (DEBUG) { System.out.println("RecordComponents ::= RecordComponents COMMA..."); } //$NON-NLS-1$
consumeRecordComponents();
break;
- case 332 : if (DEBUG) { System.out.println("RecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 336 : if (DEBUG) { System.out.println("RecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecordComponent(false);
break;
- case 333 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 337 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecordComponent(true);
break;
- case 334 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 338 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecordComponent(true);
break;
- case 335 : if (DEBUG) { System.out.println("RecordBody ::= LBRACE RecordBodyDeclarationopt RBRACE"); } //$NON-NLS-1$
+ case 339 : if (DEBUG) { System.out.println("RecordBody ::= LBRACE RecordBodyDeclarationopt RBRACE"); } //$NON-NLS-1$
consumeRecordBody();
break;
- case 336 : if (DEBUG) { System.out.println("RecordBodyDeclarationopt ::="); } //$NON-NLS-1$
+ case 340 : if (DEBUG) { System.out.println("RecordBodyDeclarationopt ::="); } //$NON-NLS-1$
consumeEmptyRecordBodyDeclaration();
break;
- case 339 : if (DEBUG) { System.out.println("RecordBodyDeclarations ::= RecordBodyDeclarations..."); } //$NON-NLS-1$
+ case 343 : if (DEBUG) { System.out.println("RecordBodyDeclarations ::= RecordBodyDeclarations..."); } //$NON-NLS-1$
consumeRecordBodyDeclarations();
break;
- case 340 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= ClassBodyDeclaration"); } //$NON-NLS-1$
+ case 344 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= ClassBodyDeclaration"); } //$NON-NLS-1$
consumeRecordBodyDeclaration();
break;
- case 341 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= CompactConstructorDeclaration"); } //$NON-NLS-1$
+ case 345 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= CompactConstructorDeclaration"); } //$NON-NLS-1$
consumeRecordBodyDeclaration();
break;
- case 342 : if (DEBUG) { System.out.println("CompactConstructorDeclaration ::=..."); } //$NON-NLS-1$
+ case 346 : if (DEBUG) { System.out.println("CompactConstructorDeclaration ::=..."); } //$NON-NLS-1$
consumeCompactConstructorDeclaration();
break;
- case 343 : if (DEBUG) { System.out.println("CompactConstructorHeader ::=..."); } //$NON-NLS-1$
+ case 347 : if (DEBUG) { System.out.println("CompactConstructorHeader ::=..."); } //$NON-NLS-1$
consumeCompactConstructorHeader();
break;
- case 344 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
+ case 348 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
consumeCompactConstructorHeaderName();
break;
- case 345 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 349 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
consumeCompactConstructorHeaderNameWithTypeParameters();
break;
- case 347 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$
+ case 351 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$
consumeInstanceOfExpression();
break;
- case 351 : if (DEBUG) { System.out.println("TypeTestPattern ::= Type Identifier"); } //$NON-NLS-1$
+ case 355 : if (DEBUG) { System.out.println("TypeTestPattern ::= Type Identifier"); } //$NON-NLS-1$
consumeTypeTestPattern();
break;
- case 353 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$
+ case 357 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$
consumePushLeftBrace();
break;
- case 354 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$
+ case 358 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$
consumeEmptyArrayInitializer();
break;
- case 355 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
+ case 359 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
consumeArrayInitializer();
break;
- case 356 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
+ case 360 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
consumeArrayInitializer();
break;
- case 358 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$
+ case 362 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$
consumeVariableInitializers();
break;
- case 359 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$
+ case 363 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$
consumeBlock();
break;
- case 360 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$
+ case 364 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$
consumeOpenBlock() ;
break;
- case 361 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatement"); } //$NON-NLS-1$
+ case 365 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatement"); } //$NON-NLS-1$
consumeBlockStatement() ;
break;
- case 362 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$
+ case 366 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$
consumeBlockStatements() ;
break;
- case 370 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$
+ case 374 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$
consumeInvalidInterfaceDeclaration();
break;
- case 371 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$
+ case 375 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$
consumeInvalidAnnotationTypeDeclaration();
break;
- case 372 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$
+ case 376 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$
consumeInvalidEnumDeclaration();
break;
- case 373 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$
+ case 377 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$
consumeLocalVariableDeclarationStatement();
break;
- case 374 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$
+ case 378 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$
consumeLocalVariableDeclaration();
break;
- case 375 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$
+ case 379 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$
consumeLocalVariableDeclaration();
break;
- case 376 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$
+ case 380 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$
consumePushModifiers();
break;
- case 377 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$
+ case 381 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$
consumePushModifiersForHeader();
break;
- case 378 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$
+ case 382 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$
consumePushRealModifiers();
break;
- case 406 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$
+ case 410 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyStatement();
break;
- case 407 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$
+ case 411 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$
consumeStatementLabel() ;
break;
- case 408 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$
+ case 412 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$
consumeStatementLabel() ;
break;
- case 409 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$
+ case 413 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$
consumeLabel() ;
break;
- case 410 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$
+ case 414 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$
consumeExpressionStatement();
break;
- case 419 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 423 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementIfNoElse();
break;
- case 420 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 424 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementIfWithElse();
break;
- case 421 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$
+ case 425 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$
consumeStatementIfWithElse();
break;
- case 422 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 426 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementSwitch() ;
break;
- case 423 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$
+ case 427 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$
consumeEmptySwitchBlock() ;
break;
- case 426 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$
+ case 430 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$
consumeSwitchBlock() ;
break;
- case 428 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$
+ case 432 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$
consumeSwitchBlockStatements() ;
break;
- case 430 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$
+ case 434 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$
consumeSwitchBlockStatement() ;
break;
- case 432 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$
+ case 436 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$
consumeSwitchLabels() ;
break;
- case 433 : if (DEBUG) { System.out.println("SwitchLabel ::= SwitchLabelCaseLhs COLON"); } //$NON-NLS-1$
+ case 437 : if (DEBUG) { System.out.println("SwitchLabel ::= SwitchLabelCaseLhs COLON"); } //$NON-NLS-1$
consumeCaseLabel();
break;
- case 434 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$
+ case 438 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$
consumeDefaultLabel();
break;
- case 437 : if (DEBUG) { System.out.println("SwitchExpression ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 441 : if (DEBUG) { System.out.println("SwitchExpression ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeSwitchExpression() ;
break;
- case 440 : if (DEBUG) { System.out.println("SwitchLabeledRule ::= SwitchLabeledThrowStatement"); } //$NON-NLS-1$
+ case 444 : if (DEBUG) { System.out.println("SwitchLabeledRule ::= SwitchLabeledThrowStatement"); } //$NON-NLS-1$
consumeSwitchLabeledRule();
break;
- case 441 : if (DEBUG) { System.out.println("SwitchLabeledExpression ::= SwitchLabelExpr Expression"); } //$NON-NLS-1$
+ case 445 : if (DEBUG) { System.out.println("SwitchLabeledExpression ::= SwitchLabelExpr Expression"); } //$NON-NLS-1$
consumeSwitchLabeledExpression();
break;
- case 442 : if (DEBUG) { System.out.println("SwitchLabeledBlock ::= SwitchLabelExpr Block"); } //$NON-NLS-1$
+ case 446 : if (DEBUG) { System.out.println("SwitchLabeledBlock ::= SwitchLabelExpr Block"); } //$NON-NLS-1$
consumeSwitchLabeledBlock();
break;
- case 443 : if (DEBUG) { System.out.println("SwitchLabeledThrowStatement ::= SwitchLabelExpr..."); } //$NON-NLS-1$
+ case 447 : if (DEBUG) { System.out.println("SwitchLabeledThrowStatement ::= SwitchLabelExpr..."); } //$NON-NLS-1$
consumeSwitchLabeledThrowStatement();
break;
- case 444 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= default ARROW"); } //$NON-NLS-1$
+ case 448 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= default ARROW"); } //$NON-NLS-1$
consumeDefaultLabelExpr();
break;
- case 445 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= SwitchLabelCaseLhs BeginCaseExpr..."); } //$NON-NLS-1$
+ case 449 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= SwitchLabelCaseLhs BeginCaseExpr..."); } //$NON-NLS-1$
consumeCaseLabelExpr();
break;
- case 446 : if (DEBUG) { System.out.println("SwitchLabelCaseLhs ::= case ConstantExpressions"); } //$NON-NLS-1$
+ case 450 : if (DEBUG) { System.out.println("SwitchLabelCaseLhs ::= case ConstantExpressions"); } //$NON-NLS-1$
consumeSwitchLabelCaseLhs();
break;
- case 447 : if (DEBUG) { System.out.println("YieldStatement ::= RestrictedIdentifierYield Expression"); } //$NON-NLS-1$
+ case 451 : if (DEBUG) { System.out.println("YieldStatement ::= RestrictedIdentifierYield Expression"); } //$NON-NLS-1$
consumeStatementYield() ;
break;
- case 448 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 452 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementWhile() ;
break;
- case 449 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$
+ case 453 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$
consumeStatementWhile() ;
break;
- case 450 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$
+ case 454 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$
consumeStatementDo() ;
break;
- case 451 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$
+ case 455 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$
consumeStatementFor() ;
break;
- case 452 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$
+ case 456 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$
consumeStatementFor() ;
break;
- case 453 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$
+ case 457 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$
consumeForInit() ;
break;
- case 457 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$
+ case 461 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$
consumeStatementExpressionList() ;
break;
- case 458 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$
+ case 462 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$
consumeSimpleAssertStatement() ;
break;
- case 459 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$
+ case 463 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$
consumeAssertStatement() ;
break;
- case 460 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$
+ case 464 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$
consumeStatementBreak() ;
break;
- case 461 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$
+ case 465 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$
consumeStatementBreakWithLabel() ;
break;
- case 462 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$
+ case 466 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$
consumeStatementContinue() ;
break;
- case 463 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$
+ case 467 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$
consumeStatementContinueWithLabel() ;
break;
- case 464 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$
+ case 468 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$
consumeStatementReturn() ;
break;
- case 465 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$
+ case 469 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$
consumeStatementThrow();
break;
- case 466 : if (DEBUG) { System.out.println("ThrowExpression ::= throw Expression"); } //$NON-NLS-1$
+ case 470 : if (DEBUG) { System.out.println("ThrowExpression ::= throw Expression"); } //$NON-NLS-1$
consumeThrowExpression() ;
break;
- case 467 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$
+ case 471 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$
consumeStatementSynchronized();
break;
- case 468 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$
+ case 472 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$
consumeOnlySynchronized();
break;
- case 469 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$
+ case 473 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$
consumeStatementTry(false, false);
break;
- case 470 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$
+ case 474 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$
consumeStatementTry(true, false);
break;
- case 471 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
+ case 475 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
consumeStatementTry(false, true);
break;
- case 472 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
+ case 476 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
consumeStatementTry(true, true);
break;
- case 473 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$
+ case 477 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$
consumeResourceSpecification();
break;
- case 474 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$
+ case 478 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$
consumeResourceOptionalTrailingSemiColon(false);
break;
- case 475 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$
+ case 479 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$
consumeResourceOptionalTrailingSemiColon(true);
break;
- case 476 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$
+ case 480 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$
consumeSingleResource();
break;
- case 477 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$
+ case 481 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$
consumeMultipleResources();
break;
- case 478 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$
+ case 482 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$
consumeResourceOptionalTrailingSemiColon(true);
break;
- case 479 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$
+ case 483 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$
consumeResourceAsLocalVariableDeclaration();
break;
- case 480 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); } //$NON-NLS-1$
+ case 484 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); } //$NON-NLS-1$
consumeResourceAsLocalVariableDeclaration();
break;
- case 481 : if (DEBUG) { System.out.println("Resource ::= Name"); } //$NON-NLS-1$
+ case 485 : if (DEBUG) { System.out.println("Resource ::= Name"); } //$NON-NLS-1$
consumeResourceAsLocalVariable();
break;
- case 482 : if (DEBUG) { System.out.println("Resource ::= FieldAccess"); } //$NON-NLS-1$
+ case 486 : if (DEBUG) { System.out.println("Resource ::= FieldAccess"); } //$NON-NLS-1$
consumeResourceAsFieldAccess();
break;
- case 484 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$
+ case 488 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$
consumeExitTryBlock();
break;
- case 486 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$
+ case 490 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$
consumeCatches();
break;
- case 487 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
+ case 491 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
consumeStatementCatch() ;
break;
- case 489 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$
+ case 493 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$
consumeLeftParen();
break;
- case 490 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$
+ case 494 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$
consumeRightParen();
break;
- case 495 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$
+ case 499 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$
consumePrimaryNoNewArrayThis();
break;
- case 496 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$
+ case 500 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$
consumePrimaryNoNewArray();
break;
- case 497 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$
+ case 501 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$
consumePrimaryNoNewArrayWithName();
break;
- case 500 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$
+ case 504 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$
consumePrimaryNoNewArrayNameThis();
break;
- case 501 : if (DEBUG) { System.out.println("QualifiedSuperReceiver ::= Name DOT super"); } //$NON-NLS-1$
+ case 505 : if (DEBUG) { System.out.println("QualifiedSuperReceiver ::= Name DOT super"); } //$NON-NLS-1$
consumeQualifiedSuperReceiver();
break;
- case 502 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$
+ case 506 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayName();
break;
- case 503 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$
+ case 507 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayArrayType();
break;
- case 504 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$
+ case 508 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayPrimitiveArrayType();
break;
- case 505 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$
+ case 509 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayPrimitiveType();
break;
- case 511 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
+ case 515 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
consumeReferenceExpressionTypeArgumentsAndTrunk(false);
break;
- case 512 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
+ case 516 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
consumeReferenceExpressionTypeArgumentsAndTrunk(true);
break;
- case 513 : if (DEBUG) { System.out.println("ReferenceExpression ::= PrimitiveType Dims COLON_COLON"); } //$NON-NLS-1$
+ case 517 : if (DEBUG) { System.out.println("ReferenceExpression ::= PrimitiveType Dims COLON_COLON"); } //$NON-NLS-1$
consumeReferenceExpressionTypeForm(true);
break;
- case 514 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name Dimsopt COLON_COLON..."); } //$NON-NLS-1$
+ case 518 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name Dimsopt COLON_COLON..."); } //$NON-NLS-1$
consumeReferenceExpressionTypeForm(false);
break;
- case 515 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name BeginTypeArguments..."); } //$NON-NLS-1$
+ case 519 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name BeginTypeArguments..."); } //$NON-NLS-1$
consumeReferenceExpressionGenericTypeForm();
break;
- case 516 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$
+ case 520 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$
consumeReferenceExpressionPrimaryForm();
break;
- case 517 : if (DEBUG) { System.out.println("ReferenceExpression ::= QualifiedSuperReceiver..."); } //$NON-NLS-1$
+ case 521 : if (DEBUG) { System.out.println("ReferenceExpression ::= QualifiedSuperReceiver..."); } //$NON-NLS-1$
consumeReferenceExpressionPrimaryForm();
break;
- case 518 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$
+ case 522 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$
consumeReferenceExpressionSuperForm();
break;
- case 519 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$
+ case 523 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$
consumeEmptyTypeArguments();
break;
- case 521 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$
+ case 525 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$
consumeIdentifierOrNew(false);
break;
- case 522 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$
+ case 526 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$
consumeIdentifierOrNew(true);
break;
- case 523 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); } //$NON-NLS-1$
+ case 527 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW LambdaBody"); } //$NON-NLS-1$
consumeLambdaExpression();
break;
- case 524 : if (DEBUG) { System.out.println("NestedLambda ::="); } //$NON-NLS-1$
+ case 528 : if (DEBUG) { System.out.println("NestedLambda ::="); } //$NON-NLS-1$
consumeNestedLambda();
break;
- case 525 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier NestedLambda"); } //$NON-NLS-1$
+ case 529 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier NestedLambda"); } //$NON-NLS-1$
consumeTypeElidedLambdaParameter(false);
break;
- case 531 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$
+ case 535 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$
consumeFormalParameterList();
break;
- case 532 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$
+ case 536 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$
consumeTypeElidedLambdaParameter(true);
break;
- case 535 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$
+ case 539 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$
consumeElidedLeftBraceAndReturn();
break;
- case 536 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$
+ case 540 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$
consumeAllocationHeader();
break;
- case 537 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$
+ case 541 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionWithTypeArguments();
break;
- case 538 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$
+ case 542 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpression();
break;
- case 539 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
+ case 543 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;
break;
- case 540 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
+ case 544 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualified() ;
break;
- case 541 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
+ case 545 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualified() ;
break;
- case 542 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
+ case 546 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;
break;
- case 543 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$
+ case 547 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$
consumeEnterInstanceCreationArgumentList();
break;
- case 544 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT new"); } //$NON-NLS-1$
+ case 548 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT new"); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionName() ;
break;
- case 545 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$
+ case 549 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$
consumeClassBodyopt();
break;
- case 547 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
+ case 551 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
consumeEnterAnonymousClassBody(false);
break;
- case 548 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$
+ case 552 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$
consumeClassBodyopt();
break;
- case 550 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
+ case 554 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
consumeEnterAnonymousClassBody(true);
break;
- case 552 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$
+ case 556 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$
consumeArgumentList();
break;
- case 553 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$
+ case 557 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$
consumeArrayCreationHeader();
break;
- case 554 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$
+ case 558 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$
consumeArrayCreationHeader();
break;
- case 555 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
+ case 559 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
consumeArrayCreationExpressionWithoutInitializer();
break;
- case 556 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$
+ case 560 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$
consumeArrayCreationExpressionWithInitializer();
break;
- case 557 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
+ case 561 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
consumeArrayCreationExpressionWithoutInitializer();
break;
- case 558 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$
+ case 562 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$
consumeArrayCreationExpressionWithInitializer();
break;
- case 560 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$
+ case 564 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$
consumeDimWithOrWithOutExprs();
break;
- case 562 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotationsopt LBRACKET..."); } //$NON-NLS-1$
+ case 566 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotationsopt LBRACKET..."); } //$NON-NLS-1$
consumeDimWithOrWithOutExpr();
break;
- case 563 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$
+ case 567 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$
consumeDims();
break;
- case 566 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$
+ case 570 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$
consumeOneDimLoop(false);
break;
- case 567 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$
+ case 571 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$
consumeOneDimLoop(true);
break;
- case 568 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$
+ case 572 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$
consumeFieldAccess(false);
break;
- case 569 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$
+ case 573 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$
consumeFieldAccess(true);
break;
- case 570 : if (DEBUG) { System.out.println("FieldAccess ::= QualifiedSuperReceiver DOT Identifier"); } //$NON-NLS-1$
+ case 574 : if (DEBUG) { System.out.println("FieldAccess ::= QualifiedSuperReceiver DOT Identifier"); } //$NON-NLS-1$
consumeFieldAccess(false);
break;
- case 571 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
+ case 575 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
consumeMethodInvocationName();
break;
- case 572 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 576 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationNameWithTypeArguments();
break;
- case 573 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 577 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationPrimaryWithTypeArguments();
break;
- case 574 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ case 578 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$
consumeMethodInvocationPrimary();
break;
- case 575 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
+ case 579 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
consumeMethodInvocationPrimary();
break;
- case 576 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
+ case 580 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
consumeMethodInvocationPrimaryWithTypeArguments();
break;
- case 577 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 581 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationSuperWithTypeArguments();
break;
- case 578 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ case 582 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$
consumeMethodInvocationSuper();
break;
- case 579 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$
+ case 583 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$
consumeArrayAccess(true);
break;
- case 580 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$
+ case 584 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$
consumeArrayAccess(false);
break;
- case 581 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$
+ case 585 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$
consumeArrayAccess(false);
break;
- case 583 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$
+ case 587 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$
consumePostfixExpression();
break;
- case 586 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$
+ case 590 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS,true);
break;
- case 587 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$
+ case 591 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS,true);
break;
- case 588 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$
+ case 592 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$
consumePushPosition();
break;
- case 591 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$
+ case 595 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS);
break;
- case 592 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$
+ case 596 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS);
break;
- case 594 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$
+ case 598 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS,false);
break;
- case 595 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$
+ case 599 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS,false);
break;
- case 597 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$
+ case 601 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.TWIDDLE);
break;
- case 598 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$
+ case 602 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.NOT);
break;
- case 600 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$
+ case 604 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$
consumeCastExpressionWithPrimitiveType();
break;
- case 601 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
+ case 605 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
consumeCastExpressionWithGenericsArray();
break;
- case 602 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
+ case 606 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
consumeCastExpressionWithQualifiedGenericsArray();
break;
- case 603 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$
+ case 607 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$
consumeCastExpressionLL1();
break;
- case 604 : if (DEBUG) { System.out.println("CastExpression ::= BeginIntersectionCast PushLPAREN..."); } //$NON-NLS-1$
+ case 608 : if (DEBUG) { System.out.println("CastExpression ::= BeginIntersectionCast PushLPAREN..."); } //$NON-NLS-1$
consumeCastExpressionLL1WithBounds();
break;
- case 605 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$
+ case 609 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$
consumeCastExpressionWithNameArray();
break;
- case 606 : if (DEBUG) { System.out.println("AdditionalBoundsListOpt ::="); } //$NON-NLS-1$
+ case 610 : if (DEBUG) { System.out.println("AdditionalBoundsListOpt ::="); } //$NON-NLS-1$
consumeZeroAdditionalBounds();
break;
- case 610 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$
+ case 614 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$
consumeOnlyTypeArgumentsForCastExpression();
break;
- case 611 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$
+ case 615 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$
consumeInsideCastExpression();
break;
- case 612 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$
+ case 616 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$
consumeInsideCastExpressionLL1();
break;
- case 613 : if (DEBUG) { System.out.println("InsideCastExpressionLL1WithBounds ::="); } //$NON-NLS-1$
+ case 617 : if (DEBUG) { System.out.println("InsideCastExpressionLL1WithBounds ::="); } //$NON-NLS-1$
consumeInsideCastExpressionLL1WithBounds ();
break;
- case 614 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$
+ case 618 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$
consumeInsideCastExpressionWithQualifiedGenerics();
break;
- case 616 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ case 620 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MULTIPLY);
break;
- case 617 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ case 621 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.DIVIDE);
break;
- case 618 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ case 622 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.REMAINDER);
break;
- case 620 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$
+ case 624 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.PLUS);
break;
- case 621 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$
+ case 625 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MINUS);
break;
- case 623 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$
+ case 627 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
break;
- case 624 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$
+ case 628 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
break;
- case 625 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 629 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
break;
- case 627 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
+ case 631 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS);
break;
- case 628 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$
+ case 632 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER);
break;
- case 629 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$
+ case 633 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS_EQUAL);
break;
- case 630 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$
+ case 634 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
break;
- case 632 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$
+ case 636 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
break;
- case 633 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$
+ case 637 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.NOT_EQUAL);
break;
- case 635 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$
+ case 639 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND);
break;
- case 637 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$
+ case 641 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.XOR);
break;
- case 639 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$
+ case 643 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR);
break;
- case 641 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$
+ case 645 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND_AND);
break;
- case 643 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
+ case 647 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR_OR);
break;
- case 645 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
+ case 649 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
break;
- case 648 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$
+ case 652 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$
consumeAssignment();
break;
- case 650 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$
+ case 654 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$
ignoreExpressionAssignment();
break;
- case 651 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$
+ case 655 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(EQUAL);
break;
- case 652 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$
+ case 656 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(MULTIPLY);
break;
- case 653 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$
+ case 657 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(DIVIDE);
break;
- case 654 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$
+ case 658 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(REMAINDER);
break;
- case 655 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$
+ case 659 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(PLUS);
break;
- case 656 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$
+ case 660 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(MINUS);
break;
- case 657 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ case 661 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(LEFT_SHIFT);
break;
- case 658 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ case 662 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(RIGHT_SHIFT);
break;
- case 659 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ case 663 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);
break;
- case 660 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$
+ case 664 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(AND);
break;
- case 661 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$
+ case 665 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(XOR);
break;
- case 662 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$
+ case 666 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(OR);
break;
- case 663 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$
+ case 667 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$
consumeExpression();
break;
- case 666 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$
+ case 670 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$
consumeEmptyExpression();
break;
- case 669 : if (DEBUG) { System.out.println("ConstantExpressions ::= ConstantExpressions COMMA..."); } //$NON-NLS-1$
+ case 673 : if (DEBUG) { System.out.println("ConstantExpressions ::= ConstantExpressions COMMA..."); } //$NON-NLS-1$
consumeConstantExpressions();
break;
- case 673 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$
+ case 677 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyClassBodyDeclarationsopt();
break;
- case 674 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ case 678 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
consumeClassBodyDeclarationsopt();
break;
- case 675 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$
+ case 679 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$
consumeDefaultModifiers();
break;
- case 676 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$
+ case 680 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$
consumeModifiers();
break;
- case 677 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$
+ case 681 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$
consumeEmptyBlockStatementsopt();
break;
- case 679 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$
+ case 683 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$
consumeEmptyDimsopt();
break;
- case 681 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$
+ case 685 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$
consumeEmptyArgumentListopt();
break;
- case 685 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$
+ case 689 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$
consumeFormalParameterListopt();
break;
- case 689 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$
+ case 696 : if (DEBUG) { System.out.println("ClassHeaderPermittedSubclasses ::=..."); } //$NON-NLS-1$
+ consumeClassHeaderPermittedSubclasses();
+ break;
+
+ case 699 : if (DEBUG) { System.out.println("InterfaceHeaderPermittedSubClassesAndSubInterfaces ::="); } //$NON-NLS-1$
+ consumeInterfaceHeaderPermittedSubClassesAndSubInterfaces();
+ break;
+
+ case 700 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyInterfaceMemberDeclarationsopt();
break;
- case 690 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ case 701 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
consumeInterfaceMemberDeclarationsopt();
break;
- case 691 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$
+ case 702 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$
consumeNestedType();
break;
- case 692 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$
+ case 703 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$
consumeEmptyForInitopt();
break;
- case 694 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$
+ case 705 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$
consumeEmptyForUpdateopt();
break;
- case 698 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$
+ case 709 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$
consumeEmptyCatchesopt();
break;
- case 700 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$
+ case 711 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$
consumeEnumDeclaration();
break;
- case 701 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$
+ case 712 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$
consumeEnumHeader();
break;
- case 702 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$
+ case 713 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$
consumeEnumHeaderName();
break;
- case 703 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$
+ case 714 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$
consumeEnumHeaderNameWithTypeParameters();
break;
- case 704 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$
+ case 715 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$
consumeEnumBodyNoConstants();
break;
- case 705 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$
+ case 716 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$
consumeEnumBodyNoConstants();
break;
- case 706 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$
+ case 717 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$
consumeEnumBodyWithConstants();
break;
- case 707 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$
+ case 718 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$
consumeEnumBodyWithConstants();
break;
- case 709 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$
+ case 720 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$
consumeEnumConstants();
break;
- case 710 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
+ case 721 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
consumeEnumConstantHeaderName();
break;
- case 711 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$
+ case 722 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$
consumeEnumConstantHeader();
break;
- case 712 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$
+ case 723 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$
consumeEnumConstantWithClassBody();
break;
- case 713 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$
+ case 724 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$
consumeEnumConstantNoClassBody();
break;
- case 714 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
+ case 725 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
consumeArguments();
break;
- case 715 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$
+ case 726 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$
consumeEmptyArguments();
break;
- case 717 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$
+ case 728 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$
consumeEnumDeclarations();
break;
- case 718 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$
+ case 729 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyEnumDeclarations();
break;
- case 720 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$
+ case 731 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$
consumeEnhancedForStatement();
break;
- case 721 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$
+ case 732 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$
consumeEnhancedForStatement();
break;
- case 722 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$
+ case 733 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$
consumeEnhancedForStatementHeaderInit(false);
break;
- case 723 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$
+ case 734 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$
consumeEnhancedForStatementHeaderInit(true);
break;
- case 724 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$
+ case 735 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$
consumeEnhancedForStatementHeader();
break;
- case 725 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$
+ case 736 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 726 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$
+ case 737 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$
consumeSingleStaticImportDeclarationName();
break;
- case 727 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
+ case 738 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 728 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$
+ case 739 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$
consumeStaticImportOnDemandDeclarationName();
break;
- case 729 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
+ case 740 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
consumeTypeArguments();
break;
- case 730 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
+ case 741 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
consumeOnlyTypeArguments();
break;
- case 732 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ case 743 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
consumeTypeArgumentList1();
break;
- case 734 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$
+ case 745 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$
consumeTypeArgumentList();
break;
- case 735 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$
+ case 746 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$
consumeTypeArgument();
break;
- case 739 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$
+ case 750 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$
consumeReferenceType1();
break;
- case 740 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
+ case 751 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
consumeTypeArgumentReferenceType1();
break;
- case 742 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ case 753 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
consumeTypeArgumentList2();
break;
- case 745 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 756 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$
consumeReferenceType2();
break;
- case 746 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
+ case 757 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
consumeTypeArgumentReferenceType2();
break;
- case 748 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ case 759 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
consumeTypeArgumentList3();
break;
- case 751 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 762 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
consumeReferenceType3();
break;
- case 752 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION"); } //$NON-NLS-1$
+ case 763 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION"); } //$NON-NLS-1$
consumeWildcard();
break;
- case 753 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION WildcardBounds"); } //$NON-NLS-1$
+ case 764 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION WildcardBounds"); } //$NON-NLS-1$
consumeWildcardWithBounds();
break;
- case 754 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$
+ case 765 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$
consumeWildcardBoundsExtends();
break;
- case 755 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$
+ case 766 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$
consumeWildcardBoundsSuper();
break;
- case 756 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION GREATER"); } //$NON-NLS-1$
+ case 767 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION GREATER"); } //$NON-NLS-1$
consumeWildcard1();
break;
- case 757 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 768 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard1WithBounds();
break;
- case 758 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$
+ case 769 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$
consumeWildcardBounds1Extends();
break;
- case 759 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$
+ case 770 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$
consumeWildcardBounds1Super();
break;
- case 760 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 771 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$
consumeWildcard2();
break;
- case 761 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 772 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard2WithBounds();
break;
- case 762 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$
+ case 773 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$
consumeWildcardBounds2Extends();
break;
- case 763 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$
+ case 774 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$
consumeWildcardBounds2Super();
break;
- case 764 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 775 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard3();
break;
- case 765 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 776 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard3WithBounds();
break;
- case 766 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$
+ case 777 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$
consumeWildcardBounds3Extends();
break;
- case 767 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$
+ case 778 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$
consumeWildcardBounds3Super();
break;
- case 768 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotationsopt Identifier"); } //$NON-NLS-1$
+ case 779 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotationsopt Identifier"); } //$NON-NLS-1$
consumeTypeParameterHeader();
break;
- case 769 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$
+ case 780 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$
consumeTypeParameters();
break;
- case 771 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
+ case 782 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
consumeTypeParameterList();
break;
- case 773 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 784 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameterWithExtends();
break;
- case 774 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 785 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameterWithExtendsAndBounds();
break;
- case 776 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$
+ case 787 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$
consumeAdditionalBoundList();
break;
- case 777 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$
+ case 788 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$
consumeAdditionalBound();
break;
- case 779 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
+ case 790 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
consumeTypeParameterList1();
break;
- case 780 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$
+ case 791 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$
consumeTypeParameter1();
break;
- case 781 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 792 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameter1WithExtends();
break;
- case 782 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 793 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameter1WithExtendsAndBounds();
break;
- case 784 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$
+ case 795 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$
consumeAdditionalBoundList1();
break;
- case 785 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$
+ case 796 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$
consumeAdditionalBound1();
break;
- case 791 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$
+ case 802 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS);
break;
- case 792 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$
+ case 803 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS);
break;
- case 795 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$
+ case 806 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.TWIDDLE);
break;
- case 796 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$
+ case 807 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.NOT);
break;
- case 799 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 810 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MULTIPLY);
break;
- case 800 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$
+ case 811 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);
break;
- case 801 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 812 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.DIVIDE);
break;
- case 802 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$
+ case 813 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.DIVIDE);
break;
- case 803 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 814 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.REMAINDER);
break;
- case 804 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$
+ case 815 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.REMAINDER);
break;
- case 806 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 817 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.PLUS);
break;
- case 807 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$
+ case 818 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.PLUS);
break;
- case 808 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 819 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MINUS);
break;
- case 809 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$
+ case 820 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.MINUS);
break;
- case 811 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ case 822 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
break;
- case 812 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$
+ case 823 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);
break;
- case 813 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ case 824 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
break;
- case 814 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$
+ case 825 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);
break;
- case 815 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ case 826 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
break;
- case 816 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$
+ case 827 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);
break;
- case 818 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$
+ case 829 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS);
break;
- case 819 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$
+ case 830 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.LESS);
break;
- case 820 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$
+ case 831 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER);
break;
- case 821 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$
+ case 832 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.GREATER);
break;
- case 822 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 833 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS_EQUAL);
break;
- case 823 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$
+ case 834 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);
break;
- case 824 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 835 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
break;
- case 825 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$
+ case 836 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);
break;
- case 827 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$
+ case 838 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$
consumeInstanceOfExpressionWithName();
break;
- case 828 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 839 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$
consumeInstanceOfExpression();
break;
- case 830 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 841 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
break;
- case 831 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$
+ case 842 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);
break;
- case 832 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 843 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.NOT_EQUAL);
break;
- case 833 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$
+ case 844 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);
break;
- case 835 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$
+ case 846 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND);
break;
- case 836 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$
+ case 847 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.AND);
break;
- case 838 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 849 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.XOR);
break;
- case 839 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$
+ case 850 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.XOR);
break;
- case 841 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 852 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR);
break;
- case 842 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$
+ case 853 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.OR);
break;
- case 844 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 855 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND_AND);
break;
- case 845 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$
+ case 856 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.AND_AND);
break;
- case 847 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 858 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR_OR);
break;
- case 848 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$
+ case 859 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.OR_OR);
break;
- case 850 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 861 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
break;
- case 851 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$
+ case 862 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$
consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;
break;
- case 855 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
+ case 866 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderName() ;
break;
- case 856 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
+ case 867 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;
break;
- case 857 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
+ case 868 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;
break;
- case 858 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
+ case 869 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderName() ;
break;
- case 859 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$
+ case 870 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeader() ;
break;
- case 860 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$
+ case 871 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclaration() ;
break;
- case 862 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$
+ case 873 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyAnnotationTypeMemberDeclarationsopt() ;
break;
- case 863 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ case 874 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
consumeAnnotationTypeMemberDeclarationsopt() ;
break;
- case 865 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$
+ case 876 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeMemberDeclarations() ;
break;
- case 866 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 877 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
consumeMethodHeaderNameWithTypeParameters(true);
break;
- case 867 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 878 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeMethodHeaderName(true);
break;
- case 868 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$
+ case 879 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$
consumeEmptyMethodHeaderDefaultValue() ;
break;
- case 869 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$
+ case 880 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$
consumeMethodHeaderDefaultValue();
break;
- case 870 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$
+ case 881 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 871 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$
+ case 882 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeMemberDeclaration() ;
break;
- case 879 : if (DEBUG) { System.out.println("AnnotationName ::= AT UnannotatableName"); } //$NON-NLS-1$
+ case 890 : if (DEBUG) { System.out.println("AnnotationName ::= AT UnannotatableName"); } //$NON-NLS-1$
consumeAnnotationName() ;
break;
- case 880 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
+ case 891 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
consumeNormalAnnotation(false) ;
break;
- case 881 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$
+ case 892 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$
consumeEmptyMemberValuePairsopt() ;
break;
- case 884 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$
+ case 895 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$
consumeMemberValuePairs() ;
break;
- case 885 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$
+ case 896 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$
consumeMemberValuePair() ;
break;
- case 886 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$
+ case 897 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$
consumeEnterMemberValue() ;
break;
- case 887 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$
+ case 898 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$
consumeExitMemberValue() ;
break;
- case 889 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$
+ case 900 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$
consumeMemberValueAsName() ;
break;
- case 892 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 903 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeMemberValueArrayInitializer() ;
break;
- case 893 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 904 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeMemberValueArrayInitializer() ;
break;
- case 894 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 905 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeEmptyMemberValueArrayInitializer() ;
break;
- case 895 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 906 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeEmptyMemberValueArrayInitializer() ;
break;
- case 896 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$
+ case 907 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$
consumeEnterMemberValueArrayInitializer() ;
break;
- case 898 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$
+ case 909 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$
consumeMemberValues() ;
break;
- case 899 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$
+ case 910 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$
consumeMarkerAnnotation(false) ;
break;
- case 900 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$
+ case 911 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$
consumeSingleMemberAnnotationMemberValue() ;
break;
- case 901 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
+ case 912 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
consumeSingleMemberAnnotation(false) ;
break;
- case 902 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$
+ case 913 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$
consumeRecoveryMethodHeaderNameWithTypeParameters();
break;
- case 903 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 914 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecoveryMethodHeaderName();
break;
- case 904 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
+ case 915 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
consumeRecoveryMethodHeaderNameWithTypeParameters();
break;
- case 905 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault Type"); } //$NON-NLS-1$
+ case 916 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault Type"); } //$NON-NLS-1$
consumeRecoveryMethodHeaderName();
break;
- case 906 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
+ case 917 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 907 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
+ case 918 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
@@ -9769,15 +9828,7 @@ protected void consumeStaticOnly() {
}
}
protected void consumeTextBlock() {
- if (!this.parsingJava14Plus) {
- problemReporter().previewFeatureNotSupported(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks", CompilerOptions.VERSION_14); //$NON-NLS-1$
- } else if (!this.options.enablePreviewFeatures){
- problemReporter().previewFeatureNotEnabled(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks"); //$NON-NLS-1$
- } else {
- if (this.options.isAnyEnabled(IrritantSet.PREVIEW)) {
- problemReporter().previewFeatureUsed(this.scanner.startPosition, this.scanner.currentPosition - 1);
- }
- }
+ problemReporter().validateJavaFeatureSupport(JavaFeature.TEXT_BLOCKS, this.scanner.startPosition, this.scanner.currentPosition - 1);
char[] textBlock2 = this.scanner.getCurrentTextBlock();
TextBlock textBlock;
if (this.recordStringLiterals &&
@@ -9791,8 +9842,6 @@ protected void consumeTextBlock() {
this.scanner.startPosition,
this.scanner.currentPosition - 1,
Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr));
- // TODO
- //this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null);
} else {
textBlock = new TextBlock(
textBlock2,
@@ -10059,6 +10108,10 @@ protected void consumeToken(int type) {
checkAndSetModifiers(ClassFileConstants.AccNative);
pushOnExpressionStackLengthStack(0);
break;
+ case TokenNamenon_sealed :
+ checkAndSetModifiers(ExtraCompilerModifiers.AccNonSealed);
+ pushOnExpressionStackLengthStack(0);
+ break;
case TokenNameopen :
checkAndSetModifiers(ClassFileConstants.ACC_OPEN);
pushOnExpressionStackLengthStack(0);
@@ -10075,6 +10128,10 @@ protected void consumeToken(int type) {
checkAndSetModifiers(ClassFileConstants.AccPublic);
pushOnExpressionStackLengthStack(0);
break;
+ case TokenNameRestrictedIdentifiersealed :
+ checkAndSetModifiers(ExtraCompilerModifiers.AccSealed);
+ pushOnExpressionStackLengthStack(0);
+ break;
case TokenNametransient :
checkAndSetModifiers(ClassFileConstants.AccTransient);
pushOnExpressionStackLengthStack(0);
@@ -10241,7 +10298,6 @@ protected void consumeToken(int type) {
case TokenNamebreak :
case TokenNamecontinue :
case TokenNamereturn :
-// case TokenNamecase :
case TokenNamemodule:
case TokenNamerequires:
case TokenNameexports:
@@ -10251,6 +10307,10 @@ protected void consumeToken(int type) {
case TokenNameRestrictedIdentifierYield:
pushOnIntStack(this.scanner.startPosition);
break;
+ case TokenNameRestrictedIdentifierpermits:
+ problemReporter().validateJavaFeatureSupport(JavaFeature.SEALED_CLASSES, this.scanner.startPosition,this.scanner.currentPosition - 1);
+ pushOnIntStack(this.scanner.startPosition);
+ break;
case TokenNamecase :
this.caseLevel = this.switchNestingLevel;
pushOnIntStack(this.scanner.startPosition);
@@ -10832,13 +10892,7 @@ protected void consumeRecordDeclaration() {
TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
this.recordNestedMethodLevels.remove(typeDecl);
- if (!this.options.enablePreviewFeatures){
- problemReporter().previewFeatureNotEnabled(typeDecl.sourceStart, typeDecl.sourceEnd, "Records"); //$NON-NLS-1$
- } else {
- if (this.options.isAnyEnabled(IrritantSet.PREVIEW)) {
- problemReporter().previewFeatureUsed(typeDecl.sourceStart, typeDecl.sourceEnd);
- }
- }
+ problemReporter().validateJavaFeatureSupport(JavaFeature.RECORDS, typeDecl.sourceStart, typeDecl.sourceEnd);
//convert constructor that do not have the type's name into methods
ConstructorDeclaration cd = typeDecl.getConstructor(this);
if (cd == null) {
@@ -10881,9 +10935,6 @@ protected void consumeRecordComponentHeaderRightParen() {
this.astPtr -= length;
TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
int nestedMethodLevel = this.nestedMethod[this.nestedType];
- typeDecl.isLocalRecord = nestedMethodLevel > 0;
- if (typeDecl.isLocalRecord)
- typeDecl.modifiers |= ClassFileConstants.AccStatic; // JLS 14 Sec 14.3
this.recordNestedMethodLevels.put(typeDecl, new Integer[] {this.nestedType, nestedMethodLevel});
this.astStack[this.astPtr] = typeDecl;
// rd.sourceEnd = this.rParenPos;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
index 1ed47d1b76..a1a6383f3b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
@@ -20,22 +20,22 @@ public interface ParserBasicInformation {
public final static int
// BEGIN_AUTOGENERATED_REGION
- ERROR_SYMBOL = 132,
- MAX_NAME_LENGTH = 41,
- NUM_STATES = 1197,
+ ERROR_SYMBOL = 135,
+ MAX_NAME_LENGTH = 53,
+ NUM_STATES = 1207,
- NT_OFFSET = 132,
+ NT_OFFSET = 135,
SCOPE_UBOUND = 312,
SCOPE_SIZE = 313,
- LA_STATE_OFFSET = 18017,
+ LA_STATE_OFFSET = 17584,
MAX_LA = 1,
- NUM_RULES = 907,
- NUM_TERMINALS = 132,
- NUM_NON_TERMINALS = 418,
- NUM_SYMBOLS = 550,
- START_STATE = 981,
- EOFT_SYMBOL = 62,
- EOLT_SYMBOL = 62,
- ACCEPT_ACTION = 18016,
- ERROR_ACTION = 18017;
+ NUM_RULES = 918,
+ NUM_TERMINALS = 135,
+ NUM_NON_TERMINALS = 423,
+ NUM_SYMBOLS = 558,
+ START_STATE = 991,
+ EOFT_SYMBOL = 64,
+ EOLT_SYMBOL = 64,
+ ACCEPT_ACTION = 17583,
+ ERROR_ACTION = 17584;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
index ae1eba0042..82f5a2fb46 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
@@ -352,6 +352,9 @@ public boolean bodyStartsAtHeaderEnd(){
return this.typeDeclaration.bodyStart == this.typeDeclaration.superclass.sourceEnd+1;
}
} else {
+ if (this.typeDeclaration.permittedTypes != null)
+ return this.typeDeclaration.bodyStart
+ == this.typeDeclaration.permittedTypes[this.typeDeclaration.permittedTypes.length-1].sourceEnd+1;
return this.typeDeclaration.bodyStart
== this.typeDeclaration.superInterfaces[this.typeDeclaration.superInterfaces.length-1].sourceEnd+1;
}
@@ -797,6 +800,7 @@ public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){
case -1 :
case TokenNameextends :
case TokenNameimplements :
+ case TokenNameRestrictedIdentifierpermits:
case TokenNameGREATER :
case TokenNameRIGHT_SHIFT :
case TokenNameUNSIGNED_RIGHT_SHIFT :
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index d2deedd0d8..02bf1d262f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -16,7 +16,10 @@
package org.eclipse.jdt.internal.compiler.parser;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.compiler.InvalidInputException;
@@ -25,6 +28,7 @@ import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.impl.JavaFeature;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.util.Util;
@@ -241,6 +245,9 @@ public class Scanner implements TerminalTokens {
// text block support - 13
/* package */ int rawStart = -1;
+ //Java 15 - first _ keyword appears
+ Map<String, Integer> _Keywords = null;
+
public Scanner() {
this(false /*comment*/, false /*whitespace*/, false /*nls*/, ClassFileConstants.JDK1_3 /*sourceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true /*taskCaseSensitive*/);
}
@@ -739,96 +746,100 @@ private char[] normalize(char[] content) {
// treat all the white space and line endings
private boolean getLineContent(StringBuilder result, char[] line, int start, int end, boolean merge, boolean lastLine) {
int lastPointer = 0;
- for(int i = start; i < end; i++) {
+ for(int i = start; i < end;) {
char c = line[i];
- if (c == '\\') {
- if (i < end) {
- if (lastPointer == i) {
- lastPointer = i+1;
- } else {
- result.append(CharOperation.subarray(line, lastPointer == 0 ? start : lastPointer+1, i));
- }
- switch (line[++i]) {
- case '\\' :
- result.append('\\');
- if (i == end)
- merge = false;
- //i = lastPointer;
- lastPointer = i;
- break;
- case 's' :
- result.append(' ');
- lastPointer = i;
- break;
- case 'n' :
- result.append('\n');
- lastPointer = i;
- break;
- case 'r' :
- result.append('\r');
- lastPointer = i;
- break;
- case 'f' :
- result.append('\f');
- lastPointer = i;
- break;
- default :
- // Direct copy from scanEscapeCharacter
- int pos = i;
- char ch = line[pos];
- int number = ScannerHelper.getHexadecimalValue(ch);
- if (number >= 0 && number <= 7) {
- boolean zeroToThreeNot = number > 3;
- try {
- if (ScannerHelper.isDigit(ch = line[++pos])) {
- int digit = ScannerHelper.getHexadecimalValue(ch);
- if (digit >= 0 && digit <= 7) {
- number = (number * 8) + digit;
- if (ScannerHelper.isDigit(ch = line[++pos])) {
- if (zeroToThreeNot) {
- // has read \NotZeroToThree OctalDigit Digit --> ignore last character
+ if (c != '\\') {
+ i++;
+ continue;
+ }
+ if (i < end) {
+ if (lastPointer + 1 <= i) {
+ result.append(CharOperation.subarray(line, lastPointer == 0 ? start : lastPointer, i));
+ }
+ char next = line[++i];
+ switch (next) {
+ case '\\' :
+ result.append('\\');
+ if (i == end)
+ merge = false;
+ break;
+ case 's' :
+ result.append(' ');
+ break;
+ case 'b' :
+ result.append('\b');
+ break;
+ case 'n' :
+ result.append('\n');
+ break;
+ case 'r' :
+ result.append('\r');
+ break;
+ case 't' :
+ result.append('\t');
+ break;
+ case 'f' :
+ result.append('\f');
+ break;
+ default :
+ // Direct copy from scanEscapeCharacter
+ int pos = i + 1;
+ int number = ScannerHelper.getHexadecimalValue(next);
+ if (number >= 0 && number <= 7) {
+ boolean zeroToThreeNot = number > 3;
+ try {
+ if (ScannerHelper.isDigit(next = line[pos])) {
+ pos++;
+ int digit = ScannerHelper.getHexadecimalValue(next);
+ if (digit >= 0 && digit <= 7) {
+ number = (number * 8) + digit;
+ if (ScannerHelper.isDigit(next = line[pos])) {
+ pos++;
+ if (zeroToThreeNot) {
+ // has read \NotZeroToThree OctalDigit Digit --> ignore last character
+ } else {
+ digit = ScannerHelper.getHexadecimalValue(next);
+ if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
+ number = (number * 8) + digit;
} else {
- digit = ScannerHelper.getHexadecimalValue(ch);
- if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
- number = (number * 8) + digit;
- } else {
- // has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
- }
+ // has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
}
- } else {
- // has read \OctalDigit NonDigit--> ignore last character
}
} else {
- // has read \OctalDigit NonOctalDigit--> ignore last character
+ // has read \OctalDigit NonDigit--> ignore last character
}
} else {
- // has read \OctalDigit --> ignore last character
+ // has read \OctalDigit NonOctalDigit--> ignore last character
}
- } catch (InvalidInputException e) {
- // Unlikely as this has already been processed in scanForStringLiteral()
- }
- if (number < 255) {
- ch = (char) number;
- //replaceEscapedChar(result, line, start, end, i, lastPointer, ch);
+ } else {
+ // has read \OctalDigit --> ignore last character
}
- result.append(ch);
- lastPointer = i = pos -1;
- } else {
- // Dealing with just '\'
- result.append(c);
- lastPointer = --i;
+ } catch (InvalidInputException e) {
+ // Unlikely as this has already been processed in scanForStringLiteral()
}
- }
+ if (number < 255) {
+ next = (char) number;
+ }
+ result.append(next);
+ lastPointer = i = pos;
+ continue;
+ } else {
+ // Dealing with just '\'
+ result.append(c);
+ lastPointer = i;
+ continue;
+ }
}
+ lastPointer = ++i;
}
}
end = merge ? end : end >= line.length ? end : end + 1;
char[] chars = lastPointer == 0 ?
CharOperation.subarray(line, start, end) :
- CharOperation.subarray(line, lastPointer + 1, end);
+ CharOperation.subarray(line, lastPointer, end);
// The below check is because CharOperation.subarray tend to return null when the
// boundaries produce a zero sized char[]
- if (chars != null)
+ if (chars != null && chars.length > 0)
result.append(chars);
return (!merge && !lastLine);
}
@@ -2108,28 +2119,28 @@ private int scanForStringLiteral() throws InvalidInputException {
int oldPos = this.currentPosition - 1;
scanEscapeCharacter();
switch (this.currentCharacter) {
- case ' ':
- if (this.withoutUnicodePtr == 0) {
- unicodeInitializeBuffer(this.currentPosition - this.startPosition);
- }
- // Kludge, retain the '\' and also
- // when scanEscapeCharacter reads space in form of \040 and
- // set the next character to 's'
- // so, we get an escaped scape, i.e. \s, which will later be
- // replaced by space
- unicodeStore('\\');
- this.currentCharacter = 's';
- break;
- case '\r':
- case '\n':
- if (this.withoutUnicodePtr == 0) {
- unicodeInitializeBuffer(this.currentPosition - this.startPosition);
+// case ' ':
+// if (this.withoutUnicodePtr == 0) {
+// unicodeInitializeBuffer(this.currentPosition - this.startPosition);
+// }
+// // Kludge, retain the '\' and also
+// // when scanEscapeCharacter reads space in form of \040 and
+// // set the next character to 's'
+// // so, we get an escaped scape, i.e. \s, which will later be
+// // replaced by space
+// unicodeStore('\\');
+// this.currentCharacter = 's';
+// break;
+ default:
+ if (ScannerHelper.isWhitespace(this.currentCharacter)) {
+ if (this.withoutUnicodePtr == 0) {
+ unicodeInitializeBuffer(this.currentPosition - this.startPosition);
+ }
+ unicodeStore('\\');
+ this.currentPosition = oldPos;
+ this.currentCharacter = this.source[this.currentPosition];
+ break outer;
}
- unicodeStore('\\');
- this.currentPosition = oldPos;
- this.currentCharacter = this.source[this.currentPosition];
- break outer;
-
}
}
if (this.withoutUnicodePtr != 0) {
@@ -3825,8 +3836,10 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
case 3 :
if ((data[++index] == 'e') && (data[++index] == 'w'))
return TokenNamenew;
- else
- return TokenNameIdentifier;
+ else {
+ int token = checkFor_KeyWord(index - 1, length, data);
+ return token != TokenNameNotAToken ? token : TokenNameIdentifier;
+ }
case 4 :
if ((data[++index] == 'u') && (data[++index] == 'l') && (data[++index] == 'l'))
return TokenNamenull;
@@ -3876,7 +3889,7 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
} else
return TokenNameIdentifier;
case 7 :
- if (data[++index] == 'a')
+ if (data[++index] == 'a') {
if ((data[++index] == 'c')
&& (data[++index] == 'k')
&& (data[++index] == 'a')
@@ -3885,7 +3898,7 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
return TokenNamepackage;
else
return TokenNameIdentifier;
- else
+ } else {
if ((data[index] == 'r')
&& (data[++index] == 'i')
&& (data[++index] == 'v')
@@ -3893,8 +3906,16 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
&& (data[++index] == 't')
&& (data[++index] == 'e')) {
return TokenNameprivate;
- } else
+ } else if ((data[index] == 'e')
+ && (data[++index] == 'r')
+ && (data[++index] == 'm')
+ && (data[++index] == 'i')
+ && (data[++index] == 't')
+ && (data[++index] == 's')) {
+ return disambiguatedRestrictedIdentifierpermits(TokenNameRestrictedIdentifierpermits);
+ } else
return TokenNameIdentifier;
+ }
case 8 :
if (areRestrictedModuleKeywordsActive()
&& (data[++index] == 'r')
@@ -3986,9 +4007,15 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
&& (data[++index] == 'i')
&& (data[++index] == 't')
&& (data[++index] == 'c')
- && (data[++index] == 'h'))
+ && (data[++index] == 'h')) {
return TokenNameswitch;
- else
+ } else if ((data[index] == 'e')
+ && (data[++index] == 'a')
+ && (data[++index] == 'l')
+ && (data[++index] == 'e')
+ && (data[++index] == 'd')) {
+ return disambiguatedRestrictedIdentifiersealed(TokenNameRestrictedIdentifiersealed);
+ } else
return TokenNameIdentifier;
case 8 :
if ((data[++index] == 't')
@@ -4167,6 +4194,25 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
}
+private int checkFor_KeyWord(int index, int length, char[] data) {
+ if (this._Keywords == null) {
+ this._Keywords = new HashMap<>(0);
+ if (this.sourceLevel >= ClassFileConstants.JDK15) {
+ if (this.previewEnabled)
+ this._Keywords.put("non-sealed", TerminalTokens.TokenNamenon_sealed); //$NON-NLS-1$
+ }
+ }
+ for (String key : this._Keywords.keySet()) {
+ if (CharOperation.prefixEquals(key.toCharArray(), data, true /* isCaseSensitive */, index)) {
+ this.currentPosition = this.currentPosition - length + key.length();
+ if (this.currentPosition < this.eofPosition)
+ this.currentCharacter = data[this.currentPosition];
+ return this._Keywords.get(key);
+ }
+ }
+ return TokenNameNotAToken;
+}
+
public int scanNumber(boolean dotPrefix) throws InvalidInputException {
//when entering this method the currentCharacter is the first
@@ -4626,10 +4672,14 @@ public String toStringAction(int act) {
return "native"; //$NON-NLS-1$
case TokenNamenew :
return "new"; //$NON-NLS-1$
+ case TokenNamenon_sealed:
+ return "non-sealed"; //$NON-NLS-1$
case TokenNamenull :
return "null"; //$NON-NLS-1$
case TokenNamepackage :
return "package"; //$NON-NLS-1$
+ case TokenNameRestrictedIdentifierpermits:
+ return "permits"; //$NON-NLS-1$
case TokenNameprivate :
return "private"; //$NON-NLS-1$
case TokenNameprotected :
@@ -4638,6 +4688,8 @@ public String toStringAction(int act) {
return "public"; //$NON-NLS-1$
case TokenNamereturn :
return "return"; //$NON-NLS-1$
+ case TokenNameRestrictedIdentifiersealed:
+ return "sealed"; //$NON-NLS-1$
case TokenNameshort :
return "short"; //$NON-NLS-1$
case TokenNamestatic :
@@ -4868,6 +4920,7 @@ public static boolean isKeyword(int token) {
case TerminalTokens.TokenNameinstanceof:
case TerminalTokens.TokenNamelong:
case TerminalTokens.TokenNamenew:
+ case TerminalTokens.TokenNamenon_sealed:
case TerminalTokens.TokenNamenull:
case TerminalTokens.TokenNamenative:
case TerminalTokens.TokenNamepublic:
@@ -4893,6 +4946,8 @@ public static boolean isKeyword(int token) {
return true;
case TerminalTokens.TokenNameRestrictedIdentifierYield:
case TerminalTokens.TokenNameRestrictedIdentifierrecord:
+ case TerminalTokens.TokenNameRestrictedIdentifiersealed:
+ case TerminalTokens.TokenNameRestrictedIdentifierpermits:
// making explicit - not a (restricted) keyword but restricted identifier.
//$FALL-THROUGH$
default:
@@ -4940,7 +4995,7 @@ private static class Goal {
int first; // steer the parser towards a single minded pursuit.
int [] follow; // the definite terminal symbols that signal the successful reduction to goal.
- int rule;
+ int[] rules;
static int LambdaParameterListRule = 0;
static int IntersectionCastRule = 0;
@@ -4949,6 +5004,8 @@ private static class Goal {
static int BlockStatementoptRule = 0;
static int YieldStatementRule = 0;
static int SwitchLabelCaseLhsRule = 0;
+ static int[] RestrictedIdentifierSealedRule;
+ static int[] RestrictedIdentifierPermitsRule;
static Goal LambdaParameterListGoal;
static Goal IntersectionCastGoal;
@@ -4957,9 +5014,17 @@ private static class Goal {
static Goal BlockStatementoptGoal;
static Goal YieldStatementGoal;
static Goal SwitchLabelCaseLhsGoal;
+ static Goal RestrictedIdentifierSealedGoal;
+ static Goal RestrictedIdentifierPermitsGoal;
+
+ static int[] RestrictedIdentifierSealedFollow = { TokenNameclass, TokenNameinterface,
+ TokenNameenum, TokenNameRestrictedIdentifierrecord };// Note: enum/record allowed as error flagging rules.
+ static int[] RestrictedIdentifierPermitsFollow = { TokenNameLBRACE };
static {
+ List<Integer> ridSealed = new ArrayList<>(2);
+ List<Integer> ridPermits = new ArrayList<>();
for (int i = 1; i <= ParserBasicInformation.NUM_RULES; i++) { // 0 == $acc
if ("ParenthesizedLambdaParameterList".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
LambdaParameterListRule = i;
@@ -4979,10 +5044,18 @@ private static class Goal {
if ("YieldStatement".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
YieldStatementRule = i;
else
+ if ("Modifiersopt".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
+ ridSealed.add(i);
+ else
+ if ("PermittedSubclasses".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
+ ridPermits.add(i);
+ else
if ("SwitchLabelCaseLhs".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
SwitchLabelCaseLhsRule = i;
}
+ RestrictedIdentifierSealedRule = ridSealed.stream().mapToInt(Integer :: intValue).toArray(); // overkill but future-proof
+ RestrictedIdentifierPermitsRule = ridPermits.stream().mapToInt(Integer :: intValue).toArray();
LambdaParameterListGoal = new Goal(TokenNameARROW, new int[] { TokenNameARROW }, LambdaParameterListRule);
IntersectionCastGoal = new Goal(TokenNameLPAREN, followSetOfCast(), IntersectionCastRule);
@@ -4991,13 +5064,21 @@ private static class Goal {
BlockStatementoptGoal = new Goal(TokenNameLBRACE, new int [0], BlockStatementoptRule);
YieldStatementGoal = new Goal(TokenNameARROW, new int [0], YieldStatementRule);
SwitchLabelCaseLhsGoal = new Goal(TokenNameARROW, new int [0], SwitchLabelCaseLhsRule);
+ RestrictedIdentifierSealedGoal = new Goal(TokenNameRestrictedIdentifiersealed, RestrictedIdentifierSealedFollow, RestrictedIdentifierSealedRule);
+ RestrictedIdentifierPermitsGoal = new Goal(TokenNameRestrictedIdentifierpermits, RestrictedIdentifierPermitsFollow, RestrictedIdentifierPermitsRule);
}
Goal(int first, int [] follow, int rule) {
this.first = first;
this.follow = follow;
- this.rule = rule;
+ this.rules = new int[] {rule};
+ }
+
+ Goal(int first, int [] follow, int[] rules) {
+ this.first = first;
+ this.follow = follow;
+ this.rules = rules;
}
boolean hasBeenReached(int act, int token) {
@@ -5005,7 +5086,14 @@ private static class Goal {
System.out.println("[Goal = " + Parser.name[Parser.non_terminal_index[Parser.lhs[this.rule]]] + "] " + "Saw: " + Parser.name[Parser.non_terminal_index[Parser.lhs[act]]] + "::" + //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Parser.name[Parser.terminal_index[token]]);
*/
- if (act == this.rule) {
+ boolean foundRule = false;
+ for (int i : this.rules) {
+ if (act == i) {
+ foundRule = true;
+ break;
+ }
+ }
+ if (foundRule) {
final int length = this.follow.length;
if (length == 0)
return true;
@@ -5167,6 +5255,18 @@ private VanguardParser getVanguardParser() {
this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1, isInModuleDeclaration(), this.scanContext);
return this.vanguardParser;
}
+private VanguardParser getNewVanguardParser() {
+ VanguardScanner vs = getNewVanguardScanner();
+ VanguardParser vp = new VanguardParser(vs);
+ vs.setActiveParser(vp);
+ return vp;
+}
+private VanguardScanner getNewVanguardScanner() {
+ VanguardScanner vs = new VanguardScanner(this.sourceLevel, this.complianceLevel, this.previewEnabled);
+ vs.setSource(this.source);
+ vs.resetTo(this.startPosition, this.eofPosition - 1, isInModuleDeclaration(), this.scanContext);
+ return vs;
+}
protected final boolean mayBeAtBreakPreview() {
return this.breakPreviewAllowed && this.lookBack[1] != TokenNameARROW;
}
@@ -5184,7 +5284,6 @@ protected final boolean maybeAtLambdaOrCast() { // Could the '(' we saw just now
case TokenNamefor:
case TokenNamesynchronized:
case TokenNametry:
- case TokenNamedefault:
return false; // not a viable prefix for cast or lambda.
default:
return this.activeParser.atConflictScenario(TokenNameLPAREN);
@@ -5206,6 +5305,8 @@ protected final boolean maybeAtReferenceExpression() { // Did the '<' we saw jus
case TokenNameGREATER: // public <T> List<T> foo() { /* */ }
case TokenNameRIGHT_SHIFT:// static <T extends SelfType<T>> List<T> makeSingletonList(T t) { /* */ }
case TokenNamenew: // new ArrayList<String>();
+ case TokenNamenon_sealed: // non-sealed X<T>
+ case TokenNameRestrictedIdentifiersealed: // sealed X<T>
case TokenNamepublic: // public List<String> foo() {}
case TokenNameabstract: // abstract List<String> foo() {}
case TokenNameprivate: // private List<String> foo() {}
@@ -5215,9 +5316,11 @@ protected final boolean maybeAtReferenceExpression() { // Did the '<' we saw jus
case TokenNamesuper: // ? super Context<N>
case TokenNameAND: // T extends Object & Comparable<? super T>
case TokenNameimplements: // class A implements I<Z>
+ case TokenNameRestrictedIdentifierpermits: // class A permits I<Z>
case TokenNamethrows: // throws Y<Z>
case TokenNameAT: // @Deprecated <T> void foo() {}
case TokenNameinstanceof: // if (o instanceof List<E>[])
+ case TokenNamedefault:
return false;
default:
break;
@@ -5239,6 +5342,7 @@ private final boolean maybeAtEllipsisAnnotationsStart() { // Did the '@' we saw
case TokenNameextends:
case TokenNamesuper:
case TokenNameimplements:
+ case TokenNameRestrictedIdentifierpermits:
case TokenNameDOT:
case TokenNameLBRACE:
case TokenNameinstanceof:
@@ -5297,11 +5401,20 @@ private boolean mayBeAtAnYieldStatement() {
return false;
}
}
+private boolean mayBeAtARestricedIdentifier(int restrictedIdentifier) {
+ switch (restrictedIdentifier) {
+ case TokenNameRestrictedIdentifiersealed:
+ break;
+ case TokenNameRestrictedIdentifierpermits:
+ break;
+ }
+ return true;
+}
int disambiguatedRestrictedIdentifierrecord(int restrictedIdentifierToken) {
// and here's the kludge
if (restrictedIdentifierToken != TokenNameRestrictedIdentifierrecord)
return restrictedIdentifierToken;
- if (this.sourceLevel < ClassFileConstants.JDK14 || !this.previewEnabled)
+ if (!JavaFeature.RECORDS.isSupported(this.complianceLevel, this.previewEnabled))
return TokenNameIdentifier;
return disambiguaterecordWithLookAhead() ?
@@ -5343,6 +5456,11 @@ private boolean disambiguaterecordWithLookAhead() {
if (lookAhead1 == TokenNameIdentifier) {
int lookAhead2 = this.vanguardScanner.getNextToken();
lookAhead2 = lookAhead2 == TokenNameLESS ? getNextTokenAfterTypeParameterHeader() : lookAhead2;
+ if (lookAhead2 == TokenNameLBRACE) {
+ // record X {} is considered a record (albeit illegal),
+ // This is so that we can issue an appropriate syntax error
+ return true;
+ }
return lookAhead2 == TokenNameLPAREN;
}
} catch (InvalidInputException e) {
@@ -5421,6 +5539,26 @@ private boolean disambiguateYieldWithLookAhead() {
}
return false; // IIE event;
}
+int disambiguatedRestrictedIdentifierpermits(int restrictedIdentifierToken) {
+ // and here's the kludge
+ if (restrictedIdentifierToken != TokenNameRestrictedIdentifierpermits)
+ return restrictedIdentifierToken;
+ if (this.sourceLevel < ClassFileConstants.JDK15 || !this.previewEnabled)
+ return TokenNameIdentifier;
+
+ return disambiguatesRestrictedIdentifierWithLookAhead(this::mayBeAtARestricedIdentifier,
+ restrictedIdentifierToken, Goal.RestrictedIdentifierPermitsGoal);
+}
+int disambiguatedRestrictedIdentifiersealed(int restrictedIdentifierToken) {
+ // and here's the kludge
+ if (restrictedIdentifierToken != TokenNameRestrictedIdentifiersealed)
+ return restrictedIdentifierToken;
+ if (this.sourceLevel < ClassFileConstants.JDK15 || !this.previewEnabled)
+ return TokenNameIdentifier;
+
+ return disambiguatesRestrictedIdentifierWithLookAhead(this::mayBeAtARestricedIdentifier,
+ restrictedIdentifierToken, Goal.RestrictedIdentifierSealedGoal);
+}
int disambiguatedRestrictedIdentifierYield(int restrictedIdentifierToken) {
// and here's the kludge
if (restrictedIdentifierToken != TokenNameRestrictedIdentifierYield)
@@ -5468,6 +5606,17 @@ int disambiguatedRestrictedKeyword(int restrictedKeywordToken) {
}
return token;
}
+int disambiguatesRestrictedIdentifierWithLookAhead(Predicate<Integer> checkPrecondition, int restrictedIdentifierToken, Goal goal) {
+ if (checkPrecondition.test(restrictedIdentifierToken)) {
+ VanguardParser vp = getNewVanguardParser();
+ VanguardScanner vs = (VanguardScanner) vp.scanner;
+ vs.resetTo(this.currentPosition, this.eofPosition - 1);
+ if (vp.parse(goal) == VanguardParser.SUCCESS)
+ return restrictedIdentifierToken;
+ }
+ return TokenNameIdentifier;
+}
+
private VanguardScanner getNewVanguardScanner(char[] src) {
VanguardScanner vs = new VanguardScanner(this.sourceLevel, this.complianceLevel, this.previewEnabled);
vs.setSource(src);
@@ -5523,12 +5672,12 @@ int disambiguatedToken(int token) {
}
return token;
}
-
private boolean mayBeAtCaseLabelExpr() {
if (this.lookBack[1] == TokenNamedefault || this.caseStartPosition <= 0)
return false;
return true;
}
+
protected boolean isAtAssistIdentifier() {
return false;
}
@@ -5575,10 +5724,12 @@ public int fastForward(Statement unused) {
case TokenNamelong:
case TokenNamenative:
case TokenNamenew:
+ case TokenNamenon_sealed:
case TokenNamenull:
case TokenNameprivate:
case TokenNameprotected:
case TokenNamepublic:
+ case TokenNameRestrictedIdentifiersealed:
case TokenNamereturn:
case TokenNameshort:
case TokenNamestatic:
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
index 8f6b5a870c..78cc30c741 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2018 IBM Corporation and others.
+ * Copyright (c) 2005, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -48,6 +48,7 @@ public class ScannerHelper {
private static long[][][] Tables11;
private static long[][][] Tables12;
private static long[][][] Tables13;
+ private static long[][][] Tables15;
public final static int MAX_OBVIOUS = 128;
public final static int[] OBVIOUS_IDENT_CHAR_NATURES = new int[MAX_OBVIOUS];
@@ -158,6 +159,9 @@ static void initializeTableJava12() {
static void initializeTableJava13() {
Tables13 = initializeTables("unicode12_1"); //$NON-NLS-1$
}
+static void initializeTableJava15() {
+ Tables15 = initializeTables13andPlus("unicode13"); //$NON-NLS-1$
+}
static long[][][] initializeTables(String unicode_path) {
long[][][] tempTable = new long[2][][];
tempTable[START_INDEX] = new long[3][];
@@ -227,6 +231,93 @@ static long[][][] initializeTables(String unicode_path) {
}
return tempTable;
}
+static long[][][] initializeTables13andPlus(String unicode_path) {
+ long[][][] tempTable = new long[2][][];
+ tempTable[START_INDEX] = new long[4][];
+ tempTable[PART_INDEX] = new long[5][];
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start0.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[START_INDEX][0] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start1.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[START_INDEX][1] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start2.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[START_INDEX][2] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start3.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[START_INDEX][3] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part0.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[PART_INDEX][0] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part1.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[PART_INDEX][1] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part2.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[PART_INDEX][2] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part3.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[PART_INDEX][3] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try (DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part14.rsc")))) { //$NON-NLS-1$
+ long[] readValues = new long[1024];
+ for (int i = 0; i < 1024; i++) {
+ readValues[i] = inputStream.readLong();
+ }
+ tempTable[PART_INDEX][4] = readValues;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return tempTable;
+}
private final static boolean isBitSet(long[] values, int i) {
try {
return (values[i / 64] & Bits[i % 64]) != 0;
@@ -247,6 +338,9 @@ public static boolean isJavaIdentifierPart(long complianceLevel, char c) {
return isJavaIdentifierPart(complianceLevel, (int) c);
}
private static boolean isJavaIdentifierPart0(int codePoint, long[][][] tables) {
+ return isJavaIdentifierPart0(codePoint, tables, false);
+}
+private static boolean isJavaIdentifierPart0(int codePoint, long[][][] tables, boolean isJava15orAbove) {
switch((codePoint & 0x1F0000) >> 16) {
case 0 :
return isBitSet(tables[PART_INDEX][0], codePoint & 0xFFFF);
@@ -254,7 +348,15 @@ private static boolean isJavaIdentifierPart0(int codePoint, long[][][] tables) {
return isBitSet(tables[PART_INDEX][1], codePoint & 0xFFFF);
case 2 :
return isBitSet(tables[PART_INDEX][2], codePoint & 0xFFFF);
+ case 3 :
+ if (isJava15orAbove) {
+ return isBitSet(tables[PART_INDEX][3], codePoint & 0xFFFF);
+ }
+ return false;
case 14 :
+ if (isJava15orAbove) {
+ return isBitSet(tables[PART_INDEX][4], codePoint & 0xFFFF);
+ }
return isBitSet(tables[PART_INDEX][3], codePoint & 0xFFFF);
}
return false;
@@ -295,12 +397,19 @@ public static boolean isJavaIdentifierPart(long complianceLevel, int codePoint)
initializeTableJava12();
}
return isJavaIdentifierPart0(codePoint, Tables12);
- } else {
- // java 13 supports Unicode 12.1
+ } else if (complianceLevel <= ClassFileConstants.JDK14) {
+ // java 13 and 14 support Unicode 12.1
if (Tables13 == null) {
initializeTableJava13();
}
return isJavaIdentifierPart0(codePoint, Tables13);
+
+ } else {
+ // java 15 supports Unicode 13
+ if (Tables15 == null) {
+ initializeTableJava15();
+ }
+ return isJavaIdentifierPart0(codePoint, Tables15, true);
}
}
public static boolean isJavaIdentifierPart(long complianceLevel, char high, char low) {
@@ -322,6 +431,9 @@ public static boolean isJavaIdentifierStart(long complianceLevel, char high, cha
return isJavaIdentifierStart(complianceLevel, toCodePoint(high, low));
}
private static boolean isJavaIdentifierStart0(int codePoint, long[][][] tables) {
+ return isJavaIdentifierStart0(codePoint, tables, false);
+}
+private static boolean isJavaIdentifierStart0(int codePoint, long[][][] tables, boolean isJava15orAbove) {
switch((codePoint & 0x1F0000) >> 16) {
case 0 :
return isBitSet(tables[START_INDEX][0], codePoint & 0xFFFF);
@@ -329,6 +441,10 @@ private static boolean isJavaIdentifierStart0(int codePoint, long[][][] tables)
return isBitSet(tables[START_INDEX][1], codePoint & 0xFFFF);
case 2 :
return isBitSet(tables[START_INDEX][2], codePoint & 0xFFFF);
+ case 3 :
+ if (isJava15orAbove)
+ return isBitSet(tables[START_INDEX][3], codePoint & 0xFFFF);
+ return false;
}
return false;
}
@@ -368,12 +484,18 @@ public static boolean isJavaIdentifierStart(long complianceLevel, int codePoint)
initializeTableJava12();
}
return isJavaIdentifierStart0(codePoint, Tables12);
- } else {
- // java 13 supports Unicode 12.1
+ } else if (complianceLevel <= ClassFileConstants.JDK14) {
+ // java 13 and 14 support Unicode 12.1
if (Tables13 == null) {
initializeTableJava13();
}
return isJavaIdentifierStart0(codePoint, Tables13);
+ } else {
+ // java 15 supports Unicode 13
+ if (Tables15 == null) {
+ initializeTableJava15();
+ }
+ return isJavaIdentifierStart0(codePoint, Tables15, true);
}
}
private static int toCodePoint(char high, char low) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
index aa1ba12797..fdab4c8437 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
@@ -39,76 +39,77 @@ public interface TerminalTokens {
// BEGIN_AUTOGENERATED_REGION
int TokenNameIdentifier = 21,
- TokenNameabstract = 52,
- TokenNameassert = 79,
- TokenNameboolean = 103,
- TokenNamebreak = 80,
- TokenNamebyte = 104,
- TokenNamecase = 89,
- TokenNamecatch = 105,
- TokenNamechar = 106,
- TokenNameclass = 68,
- TokenNamecontinue = 81,
- TokenNameconst = 130,
- TokenNamedefault = 74,
- TokenNamedo = 82,
- TokenNamedouble = 107,
- TokenNameelse = 117,
- TokenNameenum = 72,
- TokenNameextends = 90,
- TokenNamefalse = 41,
- TokenNamefinal = 53,
- TokenNamefinally = 114,
- TokenNamefloat = 108,
- TokenNamefor = 83,
- TokenNamegoto = 131,
- TokenNameif = 84,
- TokenNameimplements = 127,
- TokenNameimport = 109,
+ TokenNameabstract = 42,
+ TokenNameassert = 81,
+ TokenNameboolean = 105,
+ TokenNamebreak = 82,
+ TokenNamebyte = 106,
+ TokenNamecase = 91,
+ TokenNamecatch = 107,
+ TokenNamechar = 108,
+ TokenNameclass = 70,
+ TokenNamecontinue = 83,
+ TokenNameconst = 133,
+ TokenNamedefault = 76,
+ TokenNamedo = 84,
+ TokenNamedouble = 109,
+ TokenNameelse = 119,
+ TokenNameenum = 74,
+ TokenNameextends = 92,
+ TokenNamefalse = 43,
+ TokenNamefinal = 44,
+ TokenNamefinally = 116,
+ TokenNamefloat = 110,
+ TokenNamefor = 85,
+ TokenNamegoto = 134,
+ TokenNameif = 86,
+ TokenNameimplements = 130,
+ TokenNameimport = 111,
TokenNameinstanceof = 17,
- TokenNameint = 110,
- TokenNameinterface = 71,
- TokenNamelong = 111,
- TokenNamenative = 54,
+ TokenNameint = 112,
+ TokenNameinterface = 73,
+ TokenNamelong = 113,
+ TokenNamenative = 45,
TokenNamenew = 36,
- TokenNamenull = 42,
- TokenNamepackage = 88,
- TokenNameprivate = 55,
- TokenNameprotected = 56,
- TokenNamepublic = 57,
- TokenNamereturn = 85,
- TokenNameshort = 112,
+ TokenNamenon_sealed = 46,
+ TokenNamenull = 47,
+ TokenNamepackage = 90,
+ TokenNameprivate = 48,
+ TokenNameprotected = 49,
+ TokenNamepublic = 50,
+ TokenNamereturn = 87,
+ TokenNameshort = 114,
TokenNamestatic = 39,
- TokenNamestrictfp = 58,
+ TokenNamestrictfp = 51,
TokenNamesuper = 34,
- TokenNameswitch = 61,
+ TokenNameswitch = 63,
TokenNamesynchronized = 40,
TokenNamethis = 35,
- TokenNamethrow = 76,
- TokenNamethrows = 115,
- TokenNametransient = 59,
- TokenNametrue = 43,
- TokenNametry = 86,
- TokenNamevoid = 113,
- TokenNamevolatile = 60,
- TokenNamewhile = 77,
- TokenNamemodule = 118,
- TokenNameopen = 119,
- TokenNamerequires = 120,
- TokenNametransitive = 125,
- TokenNameexports = 121,
- TokenNameopens = 122,
- TokenNameto = 128,
- TokenNameuses = 123,
- TokenNameprovides = 124,
- TokenNamewith = 129,
- TokenNameIntegerLiteral = 44,
- TokenNameLongLiteral = 45,
- TokenNameFloatingPointLiteral = 46,
- TokenNameDoubleLiteral = 47,
- TokenNameCharacterLiteral = 48,
- TokenNameStringLiteral = 49,
- TokenNameTextBlock = 50,
+ TokenNamethrow = 78,
+ TokenNamethrows = 117,
+ TokenNametransient = 52,
+ TokenNametrue = 53,
+ TokenNametry = 88,
+ TokenNamevoid = 115,
+ TokenNamevolatile = 54,
+ TokenNamewhile = 79,
+ TokenNamemodule = 120,
+ TokenNameopen = 121,
+ TokenNamerequires = 122,
+ TokenNametransitive = 128,
+ TokenNameexports = 123,
+ TokenNameopens = 124,
+ TokenNameto = 131,
+ TokenNameuses = 125,
+ TokenNameprovides = 126,
+ TokenNamewith = 132,
+ TokenNameIntegerLiteral = 55,
+ TokenNameLongLiteral = 56,
+ TokenNameFloatingPointLiteral = 57,
+ TokenNameDoubleLiteral = 58,
+ TokenNameCharacterLiteral = 59,
+ TokenNameStringLiteral = 60,
+ TokenNameTextBlock = 61,
TokenNamePLUS_PLUS = 2,
TokenNameMINUS_MINUS = 3,
TokenNameEQUAL_EQUAL = 19,
@@ -118,56 +119,58 @@ public interface TerminalTokens {
TokenNameLEFT_SHIFT = 18,
TokenNameRIGHT_SHIFT = 14,
TokenNameUNSIGNED_RIGHT_SHIFT = 16,
- TokenNamePLUS_EQUAL = 91,
- TokenNameMINUS_EQUAL = 92,
- TokenNameMULTIPLY_EQUAL = 93,
- TokenNameDIVIDE_EQUAL = 94,
- TokenNameAND_EQUAL = 95,
- TokenNameOR_EQUAL = 96,
- TokenNameXOR_EQUAL = 97,
- TokenNameREMAINDER_EQUAL = 98,
- TokenNameLEFT_SHIFT_EQUAL = 99,
- TokenNameRIGHT_SHIFT_EQUAL = 100,
- TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 101,
+ TokenNamePLUS_EQUAL = 93,
+ TokenNameMINUS_EQUAL = 94,
+ TokenNameMULTIPLY_EQUAL = 95,
+ TokenNameDIVIDE_EQUAL = 96,
+ TokenNameAND_EQUAL = 97,
+ TokenNameOR_EQUAL = 98,
+ TokenNameXOR_EQUAL = 99,
+ TokenNameREMAINDER_EQUAL = 100,
+ TokenNameLEFT_SHIFT_EQUAL = 101,
+ TokenNameRIGHT_SHIFT_EQUAL = 102,
+ TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 103,
TokenNameOR_OR = 31,
TokenNameAND_AND = 30,
TokenNamePLUS = 4,
TokenNameMINUS = 5,
- TokenNameNOT = 64,
+ TokenNameNOT = 66,
TokenNameREMAINDER = 9,
TokenNameXOR = 24,
TokenNameAND = 22,
TokenNameMULTIPLY = 8,
TokenNameOR = 28,
- TokenNameTWIDDLE = 65,
+ TokenNameTWIDDLE = 67,
TokenNameDIVIDE = 10,
TokenNameGREATER = 15,
TokenNameLESS = 11,
TokenNameLPAREN = 23,
TokenNameRPAREN = 26,
- TokenNameLBRACE = 37,
+ TokenNameLBRACE = 38,
TokenNameRBRACE = 33,
TokenNameLBRACKET = 6,
- TokenNameRBRACKET = 67,
+ TokenNameRBRACKET = 69,
TokenNameSEMICOLON = 25,
TokenNameQUESTION = 29,
- TokenNameCOLON = 63,
+ TokenNameCOLON = 65,
TokenNameCOMMA = 32,
TokenNameDOT = 1,
- TokenNameEQUAL = 75,
- TokenNameAT = 38,
- TokenNameELLIPSIS = 116,
- TokenNameARROW = 102,
+ TokenNameEQUAL = 77,
+ TokenNameAT = 37,
+ TokenNameELLIPSIS = 118,
+ TokenNameARROW = 104,
TokenNameCOLON_COLON = 7,
- TokenNameBeginLambda = 51,
- TokenNameBeginIntersectionCast = 66,
- TokenNameBeginTypeArguments = 87,
- TokenNameElidedSemicolonAndRightBrace = 69,
+ TokenNameBeginLambda = 62,
+ TokenNameBeginIntersectionCast = 68,
+ TokenNameBeginTypeArguments = 89,
+ TokenNameElidedSemicolonAndRightBrace = 71,
TokenNameAT308 = 27,
- TokenNameAT308DOTDOTDOT = 126,
- TokenNameBeginCaseExpr = 70,
- TokenNameRestrictedIdentifierYield = 78,
- TokenNameRestrictedIdentifierrecord = 73,
- TokenNameEOF = 62,
- TokenNameERROR = 132;
+ TokenNameAT308DOTDOTDOT = 129,
+ TokenNameBeginCaseExpr = 72,
+ TokenNameRestrictedIdentifierYield = 80,
+ TokenNameRestrictedIdentifierrecord = 75,
+ TokenNameRestrictedIdentifiersealed = 41,
+ TokenNameRestrictedIdentifierpermits = 127,
+ TokenNameEOF = 64,
+ TokenNameERROR = 135;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
index f335d2502c..fc06178f5e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
index f052bd1b8c..8593c4886f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
index cd71650e23..7fc5084986 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
index 07ff827105..c14240ad2b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
index 549601cdea..d95298b244 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
index 640f3280b3..26abf271e4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
index f4fed5c4fe..dc1833df3d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
index e3f564d99c..795d8a4512 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
index 5650dbffde..67d6770513 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
index 9fdd139819..1dc9193cb6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
index e5c6ce84ee..ee49ee4d63 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
index b1e0521e1f..8eb1dbfcff 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
index 35cad114ae..7c224e1a5c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
index 30dcc0931a..8fb72f7f67 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
index 1eebf6eeac..77b1ee95c2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
index fc05e2baa4..2416f1ff6c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
index d3c3d7b5c4..4369869c3b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
index 21865a2bdf..f1b1ae5c27 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
index 37154f98d7..4dc12bcb7a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
index a1222f34ca..5a47e821bd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
index d91fcfe4eb..e883c631ec 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
index 151c67a8e1..6c2a04052a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props
index de72d8624c..8bcde6f821 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props
@@ -67,6 +67,8 @@ ClassHeaderImplements=ClassHeaderImplements
ClassHeaderImplementsopt=ClassHeaderImplements
ClassHeaderName1=ClassHeaderName
ClassHeaderName=ClassHeaderName
+ClassHeaderPermittedSubclasses=ClassHeaderPermittedSubclasses
+ClassHeaderPermittedSubclassesopt=ClassHeaderPermittedSubclasses
ClassInstanceCreationExpression=ClassInstanceCreationExpression
ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName
ClassMemberDeclaration=ClassMemberDeclaration
@@ -180,6 +182,8 @@ InterfaceHeaderExtends=InterfaceHeaderExtends
InterfaceHeaderExtendsopt=InterfaceHeaderExtends
InterfaceHeaderName1=InterfaceHeaderName
InterfaceHeaderName=InterfaceHeaderName
+InterfaceHeaderPermittedSubClassesAndSubInterfaces=InterfaceHeaderPermittedSubClassesAndSubInterfaces
+InterfaceHeaderPermittedSubClassesAndSubInterfacesopt=InterfaceHeaderPermittedSubClassesAndSubInterfaces
InterfaceMemberDeclaration=InterfaceMemberDeclaration
InterfaceMemberDeclarations=InterfaceMemberDeclarations
InterfaceMemberDeclarationsopt=InterfaceMemberDeclarations
@@ -240,6 +244,7 @@ PackageDeclaration=PackageDeclaration
PackageDeclarationName=PackageDeclarationName
ParenthesizedCastNameAndBounds=ParenthesizedCastNameAndBounds
ParenthesizedLambdaParameterList=ParenthesizedLambdaParameterList
+PermittedSubclasses=PermittedSubclasses
PostDecrementExpression=PostDecrementExpression
PostIncrementExpression=PostIncrementExpression
PostfixExpression=Expression
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part0.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part0.rsc
new file mode 100644
index 0000000000..eadab920d7
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part0.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part1.rsc
new file mode 100644
index 0000000000..c1b58e0c42
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part14.rsc
new file mode 100644
index 0000000000..226e458f17
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part14.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part2.rsc
new file mode 100644
index 0000000000..0d12943819
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part3.rsc
new file mode 100644
index 0000000000..02f549dafe
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part3.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start0.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start0.rsc
new file mode 100644
index 0000000000..18e3c68743
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start0.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start1.rsc
new file mode 100644
index 0000000000..df84cf903e
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start2.rsc
new file mode 100644
index 0000000000..0d12943819
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start3.rsc
new file mode 100644
index 0000000000..02f549dafe
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start3.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 2b5e77eabb..b0acb468cb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -169,6 +169,8 @@ import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.Constant;
+import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
+import org.eclipse.jdt.internal.compiler.impl.JavaFeature;
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
@@ -189,6 +191,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBindin
import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
+import org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
@@ -224,6 +227,10 @@ public class ProblemReporter extends ProblemHandler {
private static String RESTRICTED_IDENTIFIER_RECORD = "RestrictedIdentifierrecord"; //$NON-NLS-1$
private static String RECORD = "record"; //$NON-NLS-1$
+ private static String RESTRICTED_IDENTIFIER_SEALED = "RestrictedIdentifiersealed"; //$NON-NLS-1$
+ private static String SEALED = "sealed"; //$NON-NLS-1$
+ private static String RESTRICTED_IDENTIFIER_PERMITS = "RestrictedIdentifierpermits"; //$NON-NLS-1$
+ private static String PERMITS = "permits"; //$NON-NLS-1$
public ProblemReporter(IErrorHandlingPolicy policy, CompilerOptions options, IProblemFactory problemFactory) {
super(policy, options, problemFactory);
@@ -603,6 +610,7 @@ public static int getIrritant(int problemID) {
case IProblem.JavadocHiddenReference:
case IProblem.JavadocMissingTagDescription:
case IProblem.JavadocInvalidSeeUrlReference:
+ case IProblem.JavadocInvalidModuleQualification:
return CompilerOptions.InvalidJavadoc;
case IProblem.JavadocMissingParamTag:
@@ -2102,20 +2110,12 @@ public void duplicateInitializationOfBlankFinalField(FieldBinding field, Referen
}
public void duplicateInitializationOfFinalLocal(LocalVariableBinding local, ASTNode location) {
String[] arguments = new String[] { new String(local.readableName())};
- if ((local.modifiers & ExtraCompilerModifiers.AccPatternVariable) == 0) {
- this.handle(
+ this.handle(
IProblem.DuplicateFinalLocalInitialization,
arguments,
arguments,
nodeSourceStart(local, location),
nodeSourceEnd(local, location));
- } else {
- this.handle(IProblem.PatternVariableNotInScope,
- arguments,
- arguments,
- nodeSourceStart(local, location),
- nodeSourceEnd(local, location));
- }
}
public void duplicateMethodInType(AbstractMethodDeclaration methodDecl, boolean equalParameters, int severity) {
MethodBinding method = methodDecl.binding;
@@ -5078,6 +5078,16 @@ public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclar
private boolean isIdentifier(int token) {
return token == TerminalTokens.TokenNameIdentifier;
}
+private boolean isRestrictedIdentifier(int token) {
+ switch(token) {
+ case TerminalTokens.TokenNameRestrictedIdentifierYield:
+ case TerminalTokens.TokenNameRestrictedIdentifierrecord:
+ case TerminalTokens.TokenNameRestrictedIdentifiersealed:
+ case TerminalTokens.TokenNameRestrictedIdentifierpermits:
+ return true;
+ default: return false;
+ }
+}
private boolean isKeyword(int token) {
switch(token) {
case TerminalTokens.TokenNameabstract:
@@ -5108,6 +5118,7 @@ private boolean isKeyword(int token) {
case TerminalTokens.TokenNameinstanceof:
case TerminalTokens.TokenNamelong:
case TerminalTokens.TokenNamenew:
+ case TerminalTokens.TokenNamenon_sealed:
case TerminalTokens.TokenNamenull:
case TerminalTokens.TokenNamenative:
case TerminalTokens.TokenNamepublic:
@@ -5133,6 +5144,8 @@ private boolean isKeyword(int token) {
return true;
case TerminalTokens.TokenNameRestrictedIdentifierYield:
case TerminalTokens.TokenNameRestrictedIdentifierrecord:
+ case TerminalTokens.TokenNameRestrictedIdentifiersealed:
+ case TerminalTokens.TokenNameRestrictedIdentifierpermits:
// making explicit - not a (restricted) keyword but restricted identifier.
//$FALL-THROUGH$
default:
@@ -5525,6 +5538,11 @@ public void javadocInvalidMemberTypeQualification(int sourceStart, int sourceEnd
this.handle(IProblem.JavadocInvalidMemberTypeQualification, NoArgument, NoArgument, sourceStart, sourceEnd);
}
}
+public void javadocInvalidModuleQualification(int sourceStart, int sourceEnd, int modifiers){
+ if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+ this.handle(IProblem.JavadocInvalidModuleQualification, NoArgument, NoArgument, sourceStart, sourceEnd);
+ }
+}
/*
* Similar implementation than invalidMethod(MessageSend...)
* Note that following problem id cannot occur for Javadoc:
@@ -8237,24 +8255,10 @@ private boolean handleSyntaxErrorOnNewTokens(
char[] errorTokenSource,
String errorTokenName,
String expectedToken) {
- boolean val = false;
if (isIdentifier(currentKind)) {
- String eTokenName = new String(errorTokenSource);
- String origExpectedToken = expectedToken;
- expectedToken = replaceIfSynthetic(expectedToken);
- if (isIdentifier(currentKind)) {
- if (RESTRICTED_IDENTIFIER_RECORD.equals(origExpectedToken) && RECORD.equals(eTokenName)) {
- if (this.options.sourceLevel < ClassFileConstants.JDK14) {
- previewFeatureNotSupported(start, end, RECORD, CompilerOptions.VERSION_14);
- val = true;
- } else if (!this.options.enablePreviewFeatures) {
- previewFeatureNotEnabled(start, end, RECORD);
- val = true;
- }
- }
- }
+ return validateRestrictedKeywords(errorTokenSource, start, end, true);
}
- return val;
+ return false;
}
private void handleSyntaxError(
int id,
@@ -8305,6 +8309,8 @@ private void syntaxError(
} else {
eTokenName = errorTokenName;
}
+ if (isRestrictedIdentifier(currentKind))
+ eTokenName = replaceIfSynthetic(eTokenName);
String[] arguments;
if(expectedToken != null) {
@@ -8335,6 +8341,10 @@ private String replaceIfSynthetic(String token) {
return "yield"; //$NON-NLS-1$
if (token.equals(RESTRICTED_IDENTIFIER_RECORD))
return RECORD;
+ if (token.equals(RESTRICTED_IDENTIFIER_SEALED))
+ return SEALED;
+ if (token.equals(RESTRICTED_IDENTIFIER_PERMITS))
+ return PERMITS;
return token;
}
public void task(String tag, String message, String priority, int start, int end){
@@ -8798,25 +8808,14 @@ public void uninitializedNonNullField(FieldBinding field, ASTNode location) {
nodeSourceEnd(field, location));
}
public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location, Scope scope) {
- if ((binding.modifiers & ExtraCompilerModifiers.AccPatternVariable) == 0) {
- binding.markAsUninitializedIn(scope);
- String[] arguments = new String[] {new String(binding.readableName())};
- this.handle(
- methodHasMissingSwitchDefault() ? IProblem.UninitializedLocalVariableHintMissingDefault : IProblem.UninitializedLocalVariable,
- arguments,
- arguments,
- nodeSourceStart(binding, location),
- nodeSourceEnd(binding, location));
- } else {
- String[] arguments = new String[] {new String(binding.readableName())};
- this.handle(
- IProblem.PatternVariableNotInScope,
- arguments,
- arguments,
- nodeSourceStart(binding, location),
- nodeSourceEnd(binding, location));
-
- }
+ binding.markAsUninitializedIn(scope);
+ String[] arguments = new String[] {new String(binding.readableName())};
+ this.handle(
+ methodHasMissingSwitchDefault() ? IProblem.UninitializedLocalVariableHintMissingDefault : IProblem.UninitializedLocalVariable,
+ arguments,
+ arguments,
+ nodeSourceStart(binding, location),
+ nodeSourceEnd(binding, location));
}
private boolean methodHasMissingSwitchDefault() {
MethodScope methodScope = null;
@@ -9524,15 +9523,8 @@ public void problemNotAnalysed(Expression token, String optionKey) {
token.sourceStart,
token.sourceEnd);
}
-public void previewFeatureNotEnabled(int sourceStart, int sourceEnd, String featureName) {
- String[] args = new String[] {featureName};
- this.handle(
- IProblem.PreviewFeatureDisabled,
- args,
- args,
- sourceStart,
- sourceEnd);
-}
+// Try not to use this. Ideally, this should only be invoked through
+// validateJavaFeatureSupport()
public void previewFeatureUsed(int sourceStart, int sourceEnd) {
this.handle(
IProblem.PreviewFeatureUsed,
@@ -9541,14 +9533,60 @@ public void previewFeatureUsed(int sourceStart, int sourceEnd) {
sourceStart,
sourceEnd);
}
-public void previewFeatureNotSupported(int sourceStart, int sourceEnd, String featureName, String sourceLevel) {
- String[] args = new String[] {featureName, sourceLevel};
- this.handle(
- IProblem.PreviewFeatureNotSupported,
- args,
- args,
- sourceStart,
- sourceEnd);
+//Returns true if the problem is handled and reported (only errors considered and not warnings)
+public boolean validateRestrictedKeywords(char[] name, int start, int end, boolean reportSyntaxError) {
+ boolean isPreviewEnabled = this.options.enablePreviewFeatures;
+ for (JavaFeature feature : JavaFeature.values()) {
+ char[][] restrictedKeywords = feature.getRestrictedKeywords();
+ for (char[] k : restrictedKeywords) {
+ if (CharOperation.equals(name, k)) {
+ if (reportSyntaxError) {
+ return validateJavaFeatureSupport(feature, start, end);
+ } else {
+ if (feature.isPreview()) {
+ int severity = isPreviewEnabled ? ProblemSeverities.Error | ProblemSeverities.Fatal : ProblemSeverities.Warning;
+ restrictedTypeName(name, CompilerOptions.versionFromJdkLevel(feature.getCompliance()), start, end, severity);
+ return isPreviewEnabled;
+ } else {
+ restrictedTypeName(name, CompilerOptions.versionFromJdkLevel(feature.getCompliance()), start, end, ProblemSeverities.Error | ProblemSeverities.Fatal);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
+public boolean validateRestrictedKeywords(char[] name, ASTNode node) {
+ return validateRestrictedKeywords(name, node.sourceStart, node.sourceEnd, false);
+}
+//Returns true if the problem is handled and reported (only errors considered and not warnings)
+public boolean validateJavaFeatureSupport(JavaFeature feature, int sourceStart, int sourceEnd) {
+ boolean versionInRange = feature.getCompliance() <= this.options.sourceLevel;
+ String version = CompilerOptions.versionFromJdkLevel(feature.getCompliance());
+ int problemId = -1;
+ if (feature.isPreview()) {
+ if (!versionInRange) {
+ problemId = IProblem.PreviewFeatureNotSupported;
+ } else if (!this.options.enablePreviewFeatures) {
+ problemId = IProblem.PreviewFeatureDisabled;
+ } else if (this.options.isAnyEnabled(IrritantSet.PREVIEW)) {
+ problemId = IProblem.PreviewFeatureUsed;
+ }
+ } else if (!versionInRange) {
+ problemId = IProblem.FeatureNotSupported;
+ }
+ if (problemId > -1) {
+ String[] args = new String[] {feature.getName(), version};
+ this.handle(
+ problemId,
+ args,
+ args,
+ sourceStart,
+ sourceEnd);
+ return true;
+ }
+ return false;
}
public void useAssertAsAnIdentifier(int sourceStart, int sourceEnd) {
this.handle(
@@ -11549,11 +11587,11 @@ public void recordAccessorMethodHasThrowsClause(ASTNode methodDeclaration) {
methodDeclaration.sourceStart,
methodDeclaration.sourceEnd);
}
-public void recordCanonicalConstructorNotPublic(AbstractMethodDeclaration methodDecl) {
+public void recordCanonicalConstructorVisibilityReduced(AbstractMethodDeclaration methodDecl) {
if (!this.options.enablePreviewFeatures)
return;
this.handle(
- IProblem.RecordCanonicalConstructorShouldBePublic,
+ IProblem.RecordCanonicalConstructorVisibilityReduced,
new String[] {
new String(methodDecl.selector)
},
@@ -11617,15 +11655,14 @@ public void recordInstanceInitializerBlockInRecord(Initializer initializer) {
initializer.sourceStart,
initializer.sourceEnd);
}
-public void recordIsAReservedTypeName(ASTNode decl) {
- if (!this.options.enablePreviewFeatures)
- return;
+public void restrictedTypeName(char[] name, String compliance, int start, int end, int severity) {
this.handle(
- IProblem.RecordIsAReservedTypeName,
- NoArgument,
- NoArgument,
- decl.sourceStart,
- decl.sourceEnd);
+ IProblem.RestrictedTypeName,
+ new String[] { new String(name), compliance},
+ new String[] { new String(name), compliance},
+ severity,
+ start,
+ end);
}
public void recordIllegalAccessorReturnType(ASTNode returnType, TypeBinding type) {
if (!this.options.enablePreviewFeatures)
@@ -11667,16 +11704,6 @@ public void recordCanonicalConstructorShouldNotBeGeneric(AbstractMethodDeclarati
methodDecl.sourceStart,
methodDecl.sourceEnd);
}
-public void recordCanonicalConstructorShouldBePublic(MethodDeclaration methodDecl) {
- if (!this.options.enablePreviewFeatures)
- return;
- this.handle(
- IProblem.RecordCanonicalConstructorShouldBePublic,
- new String[] { new String(methodDecl.selector)},
- new String[] { new String(methodDecl.selector)},
- methodDecl.sourceStart,
- methodDecl.sourceEnd);
-}
public void recordCanonicalConstructorHasThrowsClause(AbstractMethodDeclaration methodDecl) {
if (!this.options.enablePreviewFeatures)
return;
@@ -11780,6 +11807,38 @@ public void recordStaticReferenceToOuterLocalVariable(LocalVariableBinding local
node.sourceStart,
node.sourceEnd);
}
+public void recordComponentsCannotHaveModifiers(RecordComponent comp) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String[] arguments = new String[] { new String(comp.name) };
+ this.handle(
+ IProblem.RecordComponentsCannotHaveModifiers,
+ arguments,
+ arguments,
+ comp.sourceStart,
+ comp.sourceEnd);
+}
+public void recordIllegalParameterNameInCanonicalConstructor(RecordComponentBinding comp, Argument arg) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ this.handle(
+ IProblem.RecordIllegalParameterNameInCanonicalConstructor,
+ new String[] {new String(arg.name), new String(comp.name)},
+ new String[] {new String(arg.name), new String(comp.name)},
+ arg.sourceStart,
+ arg.sourceEnd);
+}
+public void recordIllegalExplicitFinalFieldAssignInCompactConstructor(FieldBinding field, FieldReference fieldRef) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String[] arguments = new String[] { new String(field.name) };
+ this.handle(
+ IProblem.RecordIllegalExplicitFinalFieldAssignInCompactConstructor,
+ arguments,
+ arguments,
+ fieldRef.sourceStart,
+ fieldRef.sourceEnd);
+}
public void recordMissingExplicitConstructorCallInNonCanonicalConstructor(ASTNode location) {
this.handle(
IProblem.RecordMissingExplicitConstructorCallInNonCanonicalConstructor,
@@ -11788,4 +11847,220 @@ public void recordMissingExplicitConstructorCallInNonCanonicalConstructor(ASTNod
location.sourceStart,
location.sourceEnd);
}
+public void recordIllegalStaticModifierForLocalClassOrInterface(SourceTypeBinding type) {
+ String[] arguments = new String[] {new String(type.sourceName())};
+ this.handle(
+ IProblem.RecordIllegalStaticModifierForLocalClassOrInterface,
+ arguments,
+ arguments,
+ type.sourceStart(),
+ type.sourceEnd());
+}
+public void localStaticsIllegalVisibilityModifierForInterfaceLocalType(SourceTypeBinding type) {
+ String[] arguments = new String[] {new String(type.sourceName())};
+ this.handle(
+ IProblem.LocalStaticsIllegalVisibilityModifierForInterfaceLocalType,
+ arguments,
+ arguments,
+ type.sourceStart(),
+ type.sourceEnd());
+}
+private void sealedMissingModifier(int problem, SourceTypeBinding type, TypeDeclaration typeDecl, TypeBinding superTypeBinding) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ String superTypeFullName = new String(superTypeBinding.readableName());
+ String superTypeShortName = new String(superTypeBinding.shortReadableName());
+ if (superTypeShortName.equals(name)) superTypeShortName = superTypeFullName;
+ this.handle(
+ problem,
+ new String[] {superTypeFullName, name},
+ new String[] {superTypeShortName, name},
+ typeDecl.sourceStart,
+ typeDecl.sourceEnd);
+}
+
+public void sealedMissingClassModifier(SourceTypeBinding type, TypeDeclaration typeDecl, TypeBinding superTypeBinding) {
+ sealedMissingModifier(IProblem.SealedMissingClassModifier, type, typeDecl, superTypeBinding);
+}
+public void sealedMissingInterfaceModifier(SourceTypeBinding type, TypeDeclaration typeDecl, TypeBinding superTypeBinding) {
+ sealedMissingModifier(IProblem.SealedMissingInterfaceModifier, type, typeDecl, superTypeBinding);
+}
+public void sealedDisAllowedNonSealedModifierInClass(SourceTypeBinding type, TypeDeclaration typeDecl) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ this.handle(
+ IProblem.SealedDisAllowedNonSealedModifierInClass,
+ new String[] { name },
+ new String[] { name },
+ typeDecl.sourceStart,
+ typeDecl.sourceEnd);
+}
+
+private void sealedSuperTypeDoesNotPermit(int problem, SourceTypeBinding type, TypeReference superType, TypeBinding superTypeBinding) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ String superTypeFullName = new String(superTypeBinding.readableName());
+ String superTypeShortName = new String(superTypeBinding.shortReadableName());
+ if (superTypeShortName.equals(name)) superTypeShortName = superTypeFullName;
+ this.handle(
+ problem,
+ new String[] {name, superTypeFullName},
+ new String[] {name, superTypeShortName},
+ superType.sourceStart,
+ superType.sourceEnd);
+}
+
+public void sealedSuperClassDoesNotPermit(SourceTypeBinding type, TypeReference superType, TypeBinding superTypeBinding) {
+ sealedSuperTypeDoesNotPermit(IProblem.SealedSuperClassDoesNotPermit, type, superType, superTypeBinding);
+}
+public void sealedSuperInterfaceDoesNotPermit(SourceTypeBinding type, TypeReference superType, TypeBinding superTypeBinding) {
+ sealedSuperTypeDoesNotPermit(IProblem.SealedSuperInterfaceDoesNotPermit, type, superType, superTypeBinding);
+}
+
+public void sealedMissingSealedModifier(SourceTypeBinding type, ASTNode node) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ this.handle(IProblem.SealedMissingSealedModifier, new String[] { name }, new String[] { name }, node.sourceStart,
+ node.sourceEnd);
+}
+
+public void sealedDuplicateTypeInPermits(SourceTypeBinding type, TypeReference reference, ReferenceBinding superType) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ this.handle(
+ IProblem.SealedDuplicateTypeInPermits,
+ new String[] {
+ new String(superType.readableName()),
+ new String(type.sourceName())},
+ new String[] {
+ new String(superType.shortReadableName()),
+ new String(type.sourceName())},
+ reference.sourceStart,
+ reference.sourceEnd);
+}
+
+public void sealedNotDirectSuperClass(ReferenceBinding type, TypeReference reference, SourceTypeBinding superType) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ this.handle(
+ IProblem.SealedNotDirectSuperClass,
+ new String[] {
+ new String(type.sourceName()),
+ new String(superType.readableName())},
+ new String[] {
+ new String(type.sourceName()),
+ new String(superType.readableName())},
+ reference.sourceStart,
+ reference.sourceEnd);
+}
+public void sealedPermittedTypeOutsideOfModule(ReferenceBinding permType, SourceTypeBinding type, ASTNode node, ModuleBinding moduleBinding) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String permTypeName = new String(permType.sourceName);
+ String name = new String(type.sourceName());
+ String moduleName = new String(moduleBinding.name());
+ String[] arguments = new String[] {permTypeName, moduleName, name};
+ this.handle(IProblem.SealedPermittedTypeOutsideOfModule,
+ arguments,
+ arguments,
+ node.sourceStart,
+ node.sourceEnd);
+}
+public void sealedPermittedTypeOutsideOfModule(SourceTypeBinding type, ASTNode node) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ this.handle(IProblem.SealedPermittedTypeOutsideOfModule, new String[] { name }, new String[] { name },
+ node.sourceStart, node.sourceEnd);
+}
+
+public void sealedPermittedTypeOutsideOfPackage(ReferenceBinding permType, SourceTypeBinding type, ASTNode node, PackageBinding packageBinding) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String permTypeName = new String(permType.sourceName);
+ String name = new String(type.sourceName());
+ String packageName = packageBinding.compoundName == CharOperation.NO_CHAR_CHAR ? "default" : //$NON-NLS-1$
+ CharOperation.toString(packageBinding.compoundName);
+ String[] arguments = new String[] {permTypeName, packageName, name};
+ this.handle(IProblem.SealedPermittedTypeOutsideOfPackage,
+ arguments,
+ arguments,
+ node.sourceStart,
+ node.sourceEnd);
+}
+
+public void sealedSealedTypeMissingPermits(SourceTypeBinding type, ASTNode node) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ this.handle(IProblem.SealedSealedTypeMissingPermits, new String[] { name }, new String[] { name }, node.sourceStart,
+ node.sourceEnd);
+}
+
+public void sealedInterfaceIsSealedAndNonSealed(SourceTypeBinding type, ASTNode node) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ this.handle(IProblem.SealedInterfaceIsSealedAndNonSealed,
+ new String[] { name },
+ new String[] { name },
+ node.sourceStart,
+ node.sourceEnd);
+}
+
+public void sealedDisAllowedNonSealedModifierInInterface(SourceTypeBinding type, TypeDeclaration typeDecl) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ this.handle(
+ IProblem.SealedDisAllowedNonSealedModifierInInterface,
+ new String[] { name },
+ new String[] { name },
+ typeDecl.sourceStart,
+ typeDecl.sourceEnd);
+}
+
+public void sealedNotDirectSuperInterface(ReferenceBinding type, TypeReference reference, SourceTypeBinding superType) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ this.handle(
+ IProblem.SealedNotDirectSuperInterface,
+ new String[] {
+ new String(type.sourceName()),
+ new String(superType.readableName())},
+ new String[] {
+ new String(type.sourceName()),
+ new String(superType.readableName())},
+ reference.sourceStart,
+ reference.sourceEnd);
+}
+
+public void sealedLocalDirectSuperTypeSealed(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ String name = new String(type.sourceName());
+ String superTypeFullName = new String(superTypeBinding.readableName());
+ String superTypeShortName = new String(superTypeBinding.shortReadableName());
+ if (superTypeShortName.equals(name)) superTypeShortName = superTypeFullName;
+ this.handle(
+ IProblem.SealedLocalDirectSuperTypeSealed,
+ new String[] {superTypeFullName, name},
+ new String[] {superTypeShortName, name},
+ superclass.sourceStart,
+ superclass.sourceEnd);
+}
+public void sealedAnonymousClassCannotExtendSealedType(TypeReference reference, TypeBinding type) {
+ if (!this.options.enablePreviewFeatures)
+ return;
+ this.handle(
+ IProblem.SealedAnonymousClassCannotExtendSealedType,
+ new String[] {new String(type.readableName())},
+ new String[] {new String(type.shortReadableName())},
+ reference.sourceStart,
+ reference.sourceEnd);
+}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index 627705e586..d920b6de59 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -891,7 +891,7 @@
1104 = You are using a preview language feature that may or may not be supported in a future release
1105 = The preview feature {0} is only available with source level {1} and above
1106 = Preview features enabled at an invalid source release level {0}, preview can be enabled only at source level {1}
-
+1107 = The Java feature ''{0}'' is only available with source level {1} and above
# more programming problems:
1200 = Unlikely argument type {0} for {1} on a {2}
1201 = Unlikely argument type for equals(): {0} seems to be unrelated to {2}
@@ -1022,7 +1022,7 @@
1722 = Breaking out of switch expressions not permitted
1723 = Continue out of switch expressions not permitted
1724 = Return within switch expressions not permitted
-# Java 14 Preview - begin
+# Java 15 Preview - begin
# Records
1730 = Illegal modifier for the record {0}; only public, private, protected, static, final and strictfp are permitted
1731 = Illegal modifier for the record {0}; only public, final and strictfp are permitted
@@ -1030,13 +1030,13 @@
1733 = User declared non-static fields {0} are not permitted in a record
1734 = Throws clause not allowed for explicitly declared accessor method
1735 = Throws clause not allowed for canonical constructor {0}
-1736 = The canonical constructor {0} of a record declaration must be declared public.
+1736 = Cannot reduce the visibility of a canonical constructor {0} from that of the record
1737 = Multiple canonical constructors {0} are not allowed
1738 = The body of a compact constructor must not contain a return statement
1739 = Duplicate component {0} in record
1740 = Illegal modifier native for method {0}; native methods are not allowed in record
1741 = Instance Initializer is not allowed in a record declaration
-1742 = Record is a restricted identifier and hence not a valid type name
+1742 = ''{0}'' is not a valid type name; it is a restricted identifier and not allowed as a type identifier in Java {1}
1743 = Illegal return type of accessor; should be the same as the declared type {0} of the record component
1744 = The accessor method must not be generic
1745 = The accessor method must be declared public
@@ -1049,13 +1049,19 @@
1752 = The type {1} may not subclass {0} explicitly
1753 = void is an invalid type for the component {0} of a record
1754 = The variable argument type {0} of the record {1} must be the last parameter
-1755 = Cannot make a static reference to the non-static variable {0} from a local record
+1755 = Cannot make a static reference to the non-static variable {0}
1756 = A record declaration {0} is not allowed in a local inner class
-1757 = A non-canonical constructor must start with an explicit invocation to a constructor
+1757 = A record component {0} cannot have modifiers
+1758 = Illegal parameter name {0} in canonical constructor, expected {1}, the corresponding component name
+1759 = Illegal explicit assignment of a final field {0} in compact constructor
+1760 = A non-canonical constructor must start with an explicit invocation to a constructor
+1761 = A local interface, enum or record {0} is implicitly static; cannot have explicit static declaration
-1760 = The pattern variable {0} is not in scope in this location
+1765 = Illegal modifier for the local interface {0}; abstract and strictfp are the only modifiers allowed explicitly
+
+1780 = The pattern variable {0} is not in scope in this location
-# Java 14 Preview - end
+# Java 15 Preview - cont.
# Additional doc
1800 = Missing uses tag
@@ -1068,6 +1074,26 @@
1807 = Missing provides class name
1808 = Invalid provides class name
1809 = Invalid provides class
+1810 = Invalid module qualification
+
+
+# Java 15 Preview - cont
+1850 = The class {1} with a sealed direct superclass or a sealed direct superinterface {0} should be declared either final, sealed, or non-sealed
+1851 = A class {0} declared as non-sealed should have either a sealed direct superclass or a sealed direct superinterface
+1852 = The type {0} extending a sealed class {1} should be a permitted subtype of {1}
+1853 = The type {0} extending a sealed interface {1} should be a permitted subtype of {1}
+1854 = A type declaration {0} that has a permits clause should have a sealed modifier
+1855 = The interface {1} with a sealed direct superinterface {0} should be declared either sealed or non-sealed
+1856 = Duplicate type {0} for the type {1} in the permits clause
+1857 = Permitted class {0} does not declare {1} as direct super class
+1858 = Permitted type {0} in a named module {1} should be declared in the same module {1} of declaring type {2}
+1859 = Permitted type {0} in an unnamed module should be declared in the same package {1} of declaring type {2}
+1860 = Sealed class lacks the permits clause and no top level or nested class from the same compilation unit declares {0} as its direct superclass
+1861 = An interface {0} is declared both sealed and non-sealed
+1862 = An interface {0} declared as non-sealed should have a sealed direct superinterface
+1863 = Permitted type {0} does not declare {1} as direct super interface
+1864 = A local class {1} cannot have a sealed direct superclass or a sealed direct superinterface {0}
+1865 = An anonymous class cannot subclass a sealed type {0}
### ELABORATIONS
## Access restrictions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java
index 0f4885d7f2..b25fd95cd1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java
@@ -116,7 +116,11 @@ public final class Messages {
public static String ast_missingCode;
public static String constant_cannotCastedInto;
public static String constant_cannotConvertedTo;
- public static String abort_againstPreviewNotAllowed;
+
+ public static String text_block;
+ public static String pattern_matching_instanceof;
+ public static String records;
+ public static String sealed_types;
static {
initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index b9a3f421e8..2311abf2a3 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -309,7 +309,7 @@ public final class AST {
* programs written in all versions of the Java language
* up to and including Java SE 13 (aka JDK 13).
* </p>
- *
+ * @deprecated Clients should use the {@link #JLS_Latest} AST API instead.
* @since 3.20
* @deprecated Clients should use the {@link #JLS_Latest} AST API instead.
*/
@@ -333,7 +333,7 @@ public final class AST {
* programs written in all versions of the Java language
* up to and including Java SE 14(aka JDK 14).
* </p>
- *
+ * @deprecated Clients should use the {@link #JLS_Latest} AST API instead.
* @since 3.22
*/
public static final int JLS14 = 14;
@@ -345,8 +345,30 @@ public final class AST {
*/
static final int JLS14_INTERNAL = JLS14;
+ /**
+ * Constant for indicating the AST API that handles JLS15.
+ * <p>
+ * This API is capable of handling all constructs in the
+ * Java language as described in the Java Language
+ * Specification, Java SE 15 Edition (JLS15).
+ * JLS15 is a superset of all earlier versions of the
+ * Java language, and the JLS15 API can be used to manipulate
+ * programs written in all versions of the Java language
+ * up to and including Java SE 15(aka JDK 15).
+ * </p>
+ *
+ * @since 3.23
+ */
+ public static final int JLS15 = 15;
+
+ /**
+ * Internal synonym for {@link #JLS15}. Use to alleviate
+ * deprecation warnings once JLS15 is deprecated
+ */
+ static final int JLS15_INTERNAL = JLS15;
+
/* Used for Java doc only*/
- private static final int JLS_Latest = JLS14;
+ private static final int JLS_Latest = JLS15;
/*
* Must not collide with a value for ICompilationUnit constants
@@ -1040,6 +1062,21 @@ public final class AST {
true/*taskCaseSensitive*/,
previewEnabled);
break;
+ case JLS15_INTERNAL :
+ this.apiLevel = level;
+ // initialize a scanner
+ compliance = ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15);
+ this.scanner = new Scanner(
+ true /*comment*/,
+ true /*whitespace*/,
+ false /*nls*/,
+ compliance /*sourceLevel*/,
+ compliance /*complianceLevel*/,
+ null/*taskTag*/,
+ null/*taskPriorities*/,
+ true/*taskCaseSensitive*/,
+ previewEnabled);
+ break;
default:
throw new IllegalArgumentException("Unsupported JLS level"); //$NON-NLS-1$
}
@@ -1119,6 +1156,7 @@ public final class AST {
t.put(JavaCore.VERSION_12, ClassFileConstants.JDK12);
t.put(JavaCore.VERSION_13, ClassFileConstants.JDK13);
t.put(JavaCore.VERSION_14, ClassFileConstants.JDK14);
+ t.put(JavaCore.VERSION_15, ClassFileConstants.JDK15);
return Collections.unmodifiableMap(t);
}
private static Map<String, Integer> getApiLevelMapTable() {
@@ -1137,6 +1175,7 @@ public final class AST {
t.put(JavaCore.VERSION_12, JLS12_INTERNAL);
t.put(JavaCore.VERSION_13, JLS13_INTERNAL);
t.put(JavaCore.VERSION_14, JLS14_INTERNAL);
+ t.put(JavaCore.VERSION_15, JLS15_INTERNAL);
return Collections.unmodifiableMap(t);
}
/**
@@ -2262,6 +2301,12 @@ public final class AST {
if (Modifier.isVolatile(flags)) {
result.add(newModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD));
}
+ if (Modifier.isSealed(flags)) {
+ result.add(newModifier(Modifier.ModifierKeyword.SEALED_KEYWORD));
+ }
+ if (Modifier.isNonSealed(flags)) {
+ result.add(newModifier(Modifier.ModifierKeyword.NON_SEALED_KEYWORD));
+ }
return result;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index 5e7a47be75..430be8ad06 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -1393,7 +1393,7 @@ class ASTConverter {
public SwitchCase convert(org.eclipse.jdt.internal.compiler.ast.CaseStatement statement) {
SwitchCase switchCase = new SwitchCase(this.ast);
- if (this.ast.apiLevel >= AST.JLS14) {
+ if (this.ast.apiLevel >= AST.JLS14_INTERNAL) {
org.eclipse.jdt.internal.compiler.ast.Expression[] expressions = statement.constantExpressions;
if (expressions == null || expressions.length == 0) {
switchCase.expressions().clear();
@@ -1410,7 +1410,7 @@ class ASTConverter {
internalSetExpression(switchCase, convert(constantExpression));
}
}
- if (this.ast.apiLevel >= AST.JLS14) {
+ if (this.ast.apiLevel >= AST.JLS14_INTERNAL) {
switchCase.setSwitchLabeledRule(statement.isExpr);
}
switchCase.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
@@ -3047,7 +3047,7 @@ class ASTConverter {
}
public Expression convert(org.eclipse.jdt.internal.compiler.ast.SwitchExpression expression) {
- if (this.ast.apiLevel < AST.JLS14) {
+ if (this.ast.apiLevel < AST.JLS14_INTERNAL) {
return createFakeNullLiteral(expression);
}
SwitchExpression switchExpression = new SwitchExpression(this.ast);
@@ -3103,7 +3103,7 @@ class ASTConverter {
}
public Expression convert(org.eclipse.jdt.internal.compiler.ast.TextBlock expression) {
- if (!this.ast.isPreviewEnabled()) {
+ if (this.ast.apiLevel < AST.JLS15_INTERNAL) {
return createFakeNullLiteral(expression);
}
int length = expression.sourceEnd - expression.sourceStart + 1;
@@ -3299,6 +3299,20 @@ class ASTConverter {
}
}
}
+ org.eclipse.jdt.internal.compiler.ast.TypeReference[] permittedTypes = typeDeclaration.permittedTypes;
+ if (permittedTypes != null) {
+ if (DOMASTUtil.isFeatureSupportedinAST(this.ast, Modifier.SEALED)) {
+ for (int index = 0, length = permittedTypes.length; index < length; index++) {
+ Type convertType = convertType(permittedTypes[index]);
+ if (convertType != null) {
+ typeDecl.permittedTypes().add(convertType);
+ }
+ }
+ if (permittedTypes.length > 0 && typeDeclaration.restrictedIdentifierStart >= 0) {
+ typeDecl.setRestrictedIdentifierStartPosition(typeDeclaration.restrictedIdentifierStart);
+ }
+ }
+ }
buildBodyDeclarations(typeDeclaration, typeDecl, isInterface);
if (this.resolveBindings) {
recordNodes(typeDecl, typeDeclaration);
@@ -3405,7 +3419,7 @@ class ASTConverter {
}
public Statement convert(org.eclipse.jdt.internal.compiler.ast.YieldStatement statement) {
- if (this.ast.apiLevel < AST.JLS14) {
+ if (this.ast.apiLevel < AST.JLS14_INTERNAL) {
return createFakeEmptyStatement(statement);
}
YieldStatement yieldStatement = new YieldStatement(this.ast);
@@ -4841,6 +4855,14 @@ class ASTConverter {
protected void recordName(Name name, org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode) {
if (compilerNode != null) {
+ if (name instanceof ModuleQualifiedName &&
+ compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
+ Name tName = ((ModuleQualifiedName)name).getName();
+ if (tName != null) {
+ recordName(tName, compilerNode);
+ return;
+ }
+ }
recordNodes(name, compilerNode);
if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) compilerNode;
@@ -4882,10 +4904,16 @@ class ASTConverter {
// Replace qualifier to have all nodes recorded
if (memberRef.getQualifier() != null) {
org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = null;
+ org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference modRef = null;
if (compilerNode instanceof JavadocFieldReference) {
org.eclipse.jdt.internal.compiler.ast.Expression expression = ((JavadocFieldReference)compilerNode).receiver;
if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
+ } else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference) {
+ modRef = (org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference) expression;
+ if (modRef.typeReference != null) {
+ typeRef = modRef.typeReference;
+ }
}
}
else if (compilerNode instanceof JavadocMessageSend) {
@@ -4894,8 +4922,17 @@ class ASTConverter {
typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
}
}
+ Name mQual = memberRef.getQualifier();
if (typeRef != null) {
- recordName(memberRef.getQualifier(), typeRef);
+ if (mQual instanceof ModuleQualifiedName
+ && modRef != null) {
+ ModuleQualifiedName moduleQualifiedName = (ModuleQualifiedName)mQual;
+ recordName(moduleQualifiedName, modRef);
+ recordName(moduleQualifiedName.getModuleQualifier(), modRef.moduleReference);
+ recordName(moduleQualifiedName.getName(), typeRef);
+ } else {
+ recordName(memberRef.getQualifier(), typeRef);
+ }
}
}
} else if (node.getNodeType() == ASTNode.METHOD_REF) {
@@ -4934,8 +4971,12 @@ class ASTConverter {
}
recordNodes(name, compilerNode);
}
+ Name mQual= methodRef.getQualifier();
// record name and qualifier
- if (typeRef != null && methodRef.getQualifier() != null) {
+ if (typeRef != null && mQual != null) {
+ if (mQual instanceof ModuleQualifiedName) {
+ recordName(mQual, javadoc.getNodeStartingAt(mQual.getStartPosition()));
+ }
recordName(methodRef.getQualifier(), typeRef);
}
}
@@ -4969,6 +5010,19 @@ class ASTConverter {
node.getNodeType() == ASTNode.QUALIFIED_NAME) {
org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(node.getStartPosition());
recordName((Name) node, compilerNode);
+ } else if (node.getNodeType() == ASTNode.MODULE_QUALIFIED_NAME) {
+ ModuleQualifiedName mqName = (ModuleQualifiedName) node;
+ org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(mqName.getStartPosition());
+ recordName(mqName, compilerNode);
+ Name name = mqName.getName();
+ if (name != null) {
+ org.eclipse.jdt.internal.compiler.ast.ASTNode internalNode = javadoc.getNodeStartingAt(name.getStartPosition());
+ recordName(name, internalNode);
+ }
+ if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference) {
+ org.eclipse.jdt.internal.compiler.ast.ASTNode internalNode = ((org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference)compilerNode).moduleReference;
+ recordNodes(mqName.getModuleQualifier(), internalNode);
+ }
} else if (node.getNodeType() == ASTNode.TAG_ELEMENT) {
// resolve member and method references binding
recordNodes(javadoc, (TagElement) node);
@@ -5584,6 +5638,12 @@ class ASTConverter {
case TerminalTokens.TokenNamedefault:
modifier = createModifier(Modifier.ModifierKeyword.DEFAULT_KEYWORD);
break;
+ case TerminalTokens.TokenNameRestrictedIdentifiersealed:
+ modifier = createModifier(Modifier.ModifierKeyword.SEALED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamenon_sealed:
+ modifier = createModifier(Modifier.ModifierKeyword.NON_SEALED_KEYWORD);
+ break;
case TerminalTokens.TokenNameAT :
// we have an annotation
if (annotations != null && indexInAnnotations < annotations.length) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
index 6393acd14c..27e0dacbe1 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
@@ -1953,6 +1953,30 @@ public class ASTMatcher {
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
+ * @noreference
+ */
+ public boolean match(ModuleQualifiedName node, Object other) {
+ if (!(other instanceof ModuleQualifiedName)) {
+ return false;
+ }
+ ModuleQualifiedName o = (ModuleQualifiedName) other;
+ return safeSubtreeMatch(node.getModuleQualifier(), o.getModuleQualifier())
+ && safeSubtreeMatch(node.getName(), o.getName());
+ }
+
+ /**
+ * Returns whether the given node and the other object match.
+ * <p>
+ * The default implementation provided by this class tests whether the
+ * other object is a node of the same type with structurally isomorphic
+ * child subtrees. Subclasses may override this method as needed.
+ * </p>
+ *
+ * @param node the node
+ * @param other the other object, or <code>null</code>
+ * @return <code>true</code> if the subtree matches, or
+ * <code>false</code> if they do not match or the other object has a
+ * different node type or is <code>null</code>
* @since 3.1
*/
public boolean match(QualifiedType node, Object other) {
@@ -2304,7 +2328,7 @@ public class ASTMatcher {
return false;
}
SwitchCase o = (SwitchCase) other;
- return ( node.getAST().apiLevel >= AST.JLS14
+ return ( node.getAST().apiLevel >= AST.JLS14_INTERNAL
? safeSubtreeListMatch(node.expressions(), o.expressions())
: compareDeprecatedSwitchExpression(node, o));
}
@@ -2579,6 +2603,11 @@ public class ASTMatcher {
return false;
}
}
+ if (DOMASTUtil.isFeatureSupportedinAST(node.getAST(), Modifier.SEALED)) {
+ if (!safeSubtreeListMatch(node.permittedTypes(), o.permittedTypes())) {
+ return false;
+ }
+ }
return (
(node.isInterface() == o.isInterface())
&& safeSubtreeMatch(node.getJavadoc(), o.getJavadoc())
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
index 57decce6db..8e78b603e4 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
@@ -988,6 +988,14 @@ public abstract class ASTNode {
/**
+ * Node type constant indicating a node of type
+ * <code>ModuleQualifiedName</code>.
+ * @see ModuleQualifiedName
+ * @since 3.23
+ */
+ public static final int MODULE_QUALIFIED_NAME = 103;
+
+ /**
* Returns the node class for the corresponding node type.
*
* @param nodeType AST node type
@@ -2164,6 +2172,22 @@ public abstract class ASTNode {
}
}
+ /**
+ * Checks that this AST operation is not used when
+ * building JLS2, JLS3, JLS4, JLS8, JLS9, JLS10, JLS11, JLS12, JLS13 or JSL14 level ASTs.
+ * <p>
+ * Use this method to prevent access to new properties that have been added in JLS15
+ * </p>
+ *
+ * @exception UnsupportedOperationException if this operation is used below JLS15
+ * @since 3.22
+ */
+ final void unsupportedBelow15() {
+ if (this.ast.apiLevel < AST.JLS15_INTERNAL) {
+ throw new UnsupportedOperationException("Operation only supported in ASTs with level JLS15 and above"); //$NON-NLS-1$
+ }
+ }
+
/**
* Checks that this AST operation is not used when
@@ -2250,7 +2274,7 @@ public abstract class ASTNode {
/**
* Checks that this AST operation is only used when
- * building JLS13 level ASTs.
+ * building JLS14 level ASTs.
* <p>
* Use this method to prevent access to new properties available only in JLS14.
* </p>
@@ -2263,6 +2287,23 @@ public abstract class ASTNode {
throw new UnsupportedOperationException("Operation only supported in JLS14 AST"); //$NON-NLS-1$
}
}
+
+ /**
+ * Checks that this AST operation is only used when
+ * building JLS15 level ASTs.
+ * <p>
+ * Use this method to prevent access to new properties available only in JLS15.
+ * </p>
+ *
+ * @exception UnsupportedOperationException if this operation is not used in JLS15
+ * @since 3.22
+ */
+ final void supportedOnlyIn15() {
+ if (this.ast.apiLevel != AST.JLS15_INTERNAL) {
+ throw new UnsupportedOperationException("Operation only supported in JLS15 AST"); //$NON-NLS-1$
+ }
+ }
+
/**
* Sets or clears this node's parent node and location.
* <p>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
index b0e323caa9..3a38da807b 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
@@ -1329,6 +1329,23 @@ public abstract class ASTVisitor {
* Visits the given type-specific AST node.
* <p>
* The default implementation does nothing and return true.
+ * Subclasses may reimplement.
+ * </p>
+ *
+ * @param node the node to visit
+ * @return <code>true</code> if the children of this node should be
+ * visited, and <code>false</code> if the children of this node should
+ * be skipped
+ * @noreference
+ */
+ public boolean visit(ModuleQualifiedName node) {
+ return true;
+ }
+
+ /**
+ * Visits the given type-specific AST node.
+ * <p>
+ * The default implementation does nothing and return true.
* Subclasses may re-implement.
* </p>
*
@@ -2758,6 +2775,19 @@ public abstract class ASTVisitor {
* </p>
*
* @param node the node to visit
+ * @noreference
+ */
+ public void endVisit(ModuleQualifiedName node) {
+ // default implementation: do nothing
+ }
+
+ /**
+ * End of visit the given type-specific AST node.
+ * <p>
+ * The default implementation does nothing. Subclasses may reimplement.
+ * </p>
+ *
+ * @param node the node to visit
* @since 3.14
*/
public void endVisit(RequiresDirective node) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index df1ff90752..664372206a 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -8,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for
@@ -36,6 +37,7 @@ import org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.JavadocFieldReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend;
+import org.eclipse.jdt.internal.compiler.ast.JavadocModuleReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocSingleNameReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference;
@@ -1332,6 +1334,19 @@ class DefaultBindingResolver extends BindingResolver {
return this.getVariableBinding(qualifiedNameReference.otherBindings[index - indexOfFirstFieldBinding - 1]);
}
}
+ } else if (node instanceof JavadocModuleReference) {
+ JavadocModuleReference modRef = (JavadocModuleReference) node;
+ if (modRef.typeReference == null) {
+ ModuleReference moduleReference = modRef.moduleReference;
+ IModuleBinding moduleBinding = getModuleBinding(moduleReference.binding);
+ if (moduleBinding != null) {
+ return moduleBinding;
+ }
+ } else {
+ if (name instanceof ModuleQualifiedName) {
+ return resolveName(((ModuleQualifiedName)name).getName());
+ }
+ }
} else if (node instanceof QualifiedTypeReference) {
QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) node;
if (qualifiedTypeReference.resolvedType == null) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
index b559ead1de..2f537df0c1 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -327,6 +327,98 @@ class DocCommentParser extends AbstractCommentParser {
return typeRef;
}
+ private ModuleQualifiedName createModuleReference(int moduleRefTokenCount) {
+ String[] identifiers = new String[moduleRefTokenCount];
+ for (int i = 0; i < moduleRefTokenCount; i++) {
+ identifiers[i] = new String(this.identifierStack[i]);
+ }
+ ModuleQualifiedName moduleRef = new ModuleQualifiedName(this.ast);
+
+ ASTNode typeRef = null;
+ typeRef = this.ast.internalNewName(identifiers);
+ int start = (int) (this.identifierPositionStack[0] >>> 32);
+ if (moduleRefTokenCount > 1) {
+ Name name = (Name)typeRef;
+ int nameIndex = moduleRefTokenCount;
+ for (int i=moduleRefTokenCount-1; i>0; i--, nameIndex--) {
+ int s = (int) (this.identifierPositionStack[i] >>> 32);
+ int e = (int) this.identifierPositionStack[i];
+ name.index = nameIndex;
+ SimpleName simpleName = ((QualifiedName)name).getName();
+ simpleName.index = nameIndex;
+ simpleName.setSourceRange(s, e-s+1);
+ name.setSourceRange(start, e-start+1);
+ name = ((QualifiedName)name).getQualifier();
+ }
+ int end = (int) this.identifierPositionStack[0];
+ name.setSourceRange(start, end-start+1);
+ name.index = nameIndex;
+ } else {
+ int end = (int) this.identifierPositionStack[0];
+ typeRef.setSourceRange(start, end-start+1);
+ }
+ moduleRef.setModuleQualifier((Name)typeRef);
+ moduleRef.setName(null);
+ moduleRef.setSourceRange(typeRef.getStartPosition(), typeRef.getLength()+1);
+ return moduleRef;
+ }
+
+ @Override
+ protected Object createModuleTypeReference(int primitiveToken, int moduleRefTokenCount) {
+ int size = this.identifierLengthStack[this.identifierLengthPtr];
+ ModuleQualifiedName moduleRef= null;
+ Name typeRef= null;
+ if (size == moduleRefTokenCount) {
+ moduleRef= createModuleReference(moduleRefTokenCount);
+ this.lastIdentifierEndPosition++;
+ } else {
+ String[] moduleIdentifiers = new String[moduleRefTokenCount];
+ String[] identifiers = new String[size- moduleRefTokenCount];
+ int pos = this.identifierPtr - size + 1;
+ for (int i = 0; i < size; i++) {
+ if (i < moduleRefTokenCount) {
+ moduleIdentifiers[i] = new String(this.identifierStack[pos+i]);
+ } else {
+ identifiers[i-moduleRefTokenCount] = new String(this.identifierStack[pos+i]);
+ }
+ }
+ moduleRef= createModuleReference(moduleRefTokenCount);
+ pos = this.identifierPtr+moduleRefTokenCount - size + 1;
+
+ if (primitiveToken == -1) {
+ typeRef = this.ast.internalNewName(identifiers);
+ // Update ref for whole name
+ int start = (int) (this.identifierPositionStack[pos] >>> 32);
+// int end = (int) this.identifierPositionStack[this.identifierPtr];
+// typeRef.setSourceRange(start, end-start+1);
+ // Update references of each simple name
+ if (size-moduleRefTokenCount > 1) {
+ Name name = typeRef;
+ int nameIndex = size-moduleRefTokenCount;
+ for (int i=this.identifierPtr; i>pos; i--, nameIndex--) {
+ int s = (int) (this.identifierPositionStack[i] >>> 32);
+ int e = (int) this.identifierPositionStack[i];
+ name.index = nameIndex;
+ SimpleName simpleName = ((QualifiedName)name).getName();
+ simpleName.index = nameIndex;
+ simpleName.setSourceRange(s, e-s+1);
+ name.setSourceRange(start, e-start+1);
+ name = ((QualifiedName)name).getQualifier();
+ }
+ int end = (int) this.identifierPositionStack[pos];
+ name.setSourceRange(start, end-start+1);
+ name.index = nameIndex;
+ } else {
+ int end = (int) this.identifierPositionStack[pos];
+ typeRef.setSourceRange(start, end-start+1);
+ }
+ moduleRef.setName(typeRef);
+ moduleRef.setSourceRange(moduleRef.getStartPosition(), moduleRef.getLength() + typeRef.getLength());
+ }
+ }
+ return moduleRef;
+ }
+
@Override
protected boolean parseIdentifierTag(boolean report) {
if (super.parseIdentifierTag(report)) {
@@ -473,7 +565,7 @@ class DocCommentParser extends AbstractCommentParser {
// Cannot have @see inside inline comment
valid = false;
} else {
- valid = parseReference();
+ valid = parseReference(true);
}
} else {
this.tagValue = TAG_OTHERS_VALUE;
@@ -491,7 +583,7 @@ class DocCommentParser extends AbstractCommentParser {
if (this.tagValue != NO_TAG_VALUE && this.tagValue != TAG_LITERAL_VALUE) {
if (this.inlineTagStarted) {
- valid = parseReference();
+ valid = parseReference(true);
} else {
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=53290
// Cannot have @link outside inline comment
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMethodBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMethodBinding.java
index 7473ca9bfe..f5f8f7113d 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMethodBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMethodBinding.java
@@ -77,6 +77,19 @@ public interface IMethodBinding extends IBinding {
public boolean isCompactConstructor();
/**
+ * Returns whether this binding is for a canonical constructor or not.
+ *
+ * <p>
+ * This method returns <code>true</code> for canonical constructors
+ * </p>
+ *
+ * @return <code>true</code> if this is the binding for a canonical constructor
+ * and <code>false</code> otherwise
+ * @noreference
+ */
+ public boolean isCanonicalConstructor();
+
+ /**
* Returns whether this binding is known to be a compiler-generated
* default constructor.
* <p>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java
index 5e61a657b9..12ea6c7a47 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java
@@ -194,7 +194,10 @@ public class InstanceofExpression extends Expression {
result.setLeftOperand((Expression) getLeftOperand().clone(target));
result.setRightOperand((Type) getRightOperand().clone(target));
if (DOMASTUtil.isInstanceofExpressionPatternSupported(target)) {
- result.setPatternVariable((SingleVariableDeclaration) getPatternVariable().clone(target));
+ SingleVariableDeclaration pv = getPatternVariable();
+ if (pv != null) {
+ result.setPatternVariable((SingleVariableDeclaration) pv.clone(target));
+ }
}
return result;
}
@@ -303,13 +306,13 @@ public class InstanceofExpression extends Expression {
* Returns the patternVariable of this instanceof expression.
*
* @return the patternVariable node
- * @exception UnsupportedOperationException if this operation is used other than JLS14
+ * @exception UnsupportedOperationException if this operation is used other than JLS15
* @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
*/
public SingleVariableDeclaration getPatternVariable() {
- supportedOnlyIn14();
+ supportedOnlyIn15();
unsupportedWithoutPreviewError();
return this.patternVariable;
}
@@ -319,13 +322,13 @@ public class InstanceofExpression extends Expression {
*
* @param referencePatternVariable the right operand node
* @exception IllegalArgumentException if:
- * @exception UnsupportedOperationException if this operation is used other than JLS14
+ * @exception UnsupportedOperationException if this operation is used other than JLS15
* @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
*/
public void setPatternVariable(SingleVariableDeclaration referencePatternVariable) {
- supportedOnlyIn14();
+ supportedOnlyIn15();
unsupportedWithoutPreviewError();
if (referencePatternVariable == null) {
throw new IllegalArgumentException();
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java
index fbc2bac346..7d938bf654 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java
@@ -81,6 +81,14 @@ class MethodBinding implements IMethodBinding {
}
/**
+ * @see IMethodBinding#isCanonicalConstructor()
+ */
+ @Override
+ public boolean isCanonicalConstructor() {
+ return ((this.binding.tagBits & TagBits.IsCanonicalConstructor) != 0);
+ }
+
+ /**
* @see IMethodBinding#isDefaultConstructor()
* @since 3.0
*/
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
index 076005c43e..37e3268d69 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
@@ -729,12 +729,12 @@ public class MethodDeclaration extends BodyDeclaration {
* and <code>false</code> if this is a method declaration
* @since 3.22
* @noreference This method is not intended to be referenced by clients.
- * @exception UnsupportedOperationException if this operation is not used in JLS14
+ * @exception UnsupportedOperationException if this operation is not used in JLS15
* @exception UnsupportedOperationException if this operation is used with previewEnabled flag as false
*/
public boolean isCompactConstructor() {
- supportedOnlyIn14();
+ supportedOnlyIn15();
unsupportedWithoutPreviewError();
return this.isCompactConstructor;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
index ea81d6cccb..56cf3a63b6 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -35,6 +35,8 @@ import java.util.Map;
* <b>volatile</b>
* <b>strictfp</b>
* <b>default</b>
+ * <b>sealed</b>
+ * <b>non-sealed</b>
* </pre>
* <p>
* The numeric values of these flags match the ones for class
@@ -105,6 +107,16 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
*/
public static final ModifierKeyword DEFAULT_KEYWORD = new ModifierKeyword("default", DEFAULT);//$NON-NLS-1$
+ /**
+ * @since 3.23
+ */
+ public static final ModifierKeyword SEALED_KEYWORD = new ModifierKeyword("sealed", SEALED);//$NON-NLS-1$
+
+ /**
+ * @since 3.23
+ */
+ public static final ModifierKeyword NON_SEALED_KEYWORD = new ModifierKeyword("non-sealed", NON_SEALED);//$NON-NLS-1$
+
static {
KEYWORDS = new HashMap(20);
ModifierKeyword[] ops = {
@@ -119,7 +131,9 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
TRANSIENT_KEYWORD,
VOLATILE_KEYWORD,
STRICTFP_KEYWORD,
- DEFAULT_KEYWORD
+ DEFAULT_KEYWORD,
+ SEALED_KEYWORD,
+ NON_SEALED_KEYWORD
};
for (int i = 0; i < ops.length; i++) {
KEYWORDS.put(ops[i].toString(), ops[i]);
@@ -312,6 +326,20 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
public static final int VOLATILE = 0x0040;
/**
+ * "sealed" modifier constant (bit mask).
+ * Applicable only to types.
+ * @since 3.23
+ */
+ public static final int SEALED = 0x0200;
+
+ /**
+ * "non-sealed" modifier constant (bit mask).
+ * Applicable only to types.
+ * @since 3.23
+ */
+ public static final int NON_SEALED = 0x1000;
+
+ /**
* "default" modifier constant (bit mask) (added in JLS8 API).
* Applicable only to methods in interfaces (but not for annotation methods with a default value).
* <p>
@@ -486,6 +514,32 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
}
/**
+ * Returns whether the given flags includes the "sealed" modifier.
+ * Applicable only to types.
+ *
+ * @param flags the modifier flags
+ * @return <code>true</code> if the <code>SEALED</code> bit is set
+ * and <code>false</code> otherwise
+ * @since 3.23
+ */
+ public static boolean isSealed(int flags) {
+ return (flags & SEALED) != 0;
+ }
+
+ /**
+ * Returns whether the given flags includes the "non-sealed" modifier.
+ * Applicable only to types.
+ *
+ * @param flags the modifier flags
+ * @return <code>true</code> if the <code>NON_SEALED</code> bit is set
+ * and <code>false</code> otherwise
+ * @since 3.23
+ */
+ public static boolean isNonSealed(int flags) {
+ return (flags & NON_SEALED) != 0;
+ }
+
+ /**
* Returns a list of structural property descriptors for this node type.
* Clients must not modify the result.
*
@@ -704,6 +758,26 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
return this.modifierKeyword == ModifierKeyword.DEFAULT_KEYWORD;
}
+ /**
+ * Answer true if the receiver is the sealed modifier, false otherwise.
+ *
+ * @return true if the receiver is the sealed modifier, false otherwise
+ * @since 3.23
+ */
+ public boolean isSealed() {
+ return this.modifierKeyword == ModifierKeyword.SEALED_KEYWORD;
+ }
+
+ /**
+ * Answer true if the receiver is the non-sealed modifier, false otherwise.
+ *
+ * @return true if the receiver is the non-sealed modifier, false otherwise
+ * @since 3.23
+ */
+ public boolean isNonSealed() {
+ return this.modifierKeyword == ModifierKeyword.NON_SEALED_KEYWORD;
+ }
+
@Override
int memSize() {
// treat ModifierKeyword as free
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java
new file mode 100644
index 0000000000..a964b57c84
--- /dev/null
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.core.dom;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * AST node for a module qualified name. A module qualified name is defined as
+ * a qualified/simple name preceded by a module name, which qualifies it. Expressing it this
+ * way means that the module qualifier and the qualified name get their own AST nodes.
+ * <pre>
+ * ModuleQualifiedName:
+ * Name <b>.</b> Name
+ * </pre>
+ *
+ *
+ *
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ * @since 3.23
+ *
+ */
+@SuppressWarnings("rawtypes")
+public class ModuleQualifiedName extends Name {
+
+ /**
+ * The "qualifier" structural property of this node type (child type: {@link Name}). *
+ */
+ public static final ChildPropertyDescriptor MODULE_QUALIFIER_PROPERTY =
+ new ChildPropertyDescriptor(ModuleQualifiedName.class, "moduleQualifier", SimpleName.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$
+
+ /**
+ * The "name" structural property of this node type (child type: {@link SimpleName}). *
+ */
+ public static final ChildPropertyDescriptor NAME_PROPERTY =
+ new ChildPropertyDescriptor(ModuleQualifiedName.class, "name", QualifiedName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$
+
+ /**
+ * A list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor}),
+ * or null if uninitialized.
+ */
+ private static final List PROPERTY_DESCRIPTORS;
+
+ static {
+ List propertyList = new ArrayList(3);
+ createPropertyList(ModuleQualifiedName.class, propertyList);
+ addProperty(MODULE_QUALIFIER_PROPERTY, propertyList);
+ addProperty(NAME_PROPERTY, propertyList);
+ PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
+ }
+
+ /**
+ * Returns a list of structural property descriptors for this node type.
+ * Clients must not modify the result.
+ *
+ * @param apiLevel the API level; one of the
+ * <code>AST.JLS*</code> constants
+ * @return a list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor})
+ */
+ public static List propertyDescriptors(int apiLevel) {
+ return PROPERTY_DESCRIPTORS;
+ }
+
+ /**
+ * The identifier; lazily initialized; defaults to a unspecified, legal
+ * Java identifier.
+ */
+ private Name moduleQualifier = null;
+
+ /**
+ * The name being module veysqualified; lazily initialized; defaults to a unspecified,
+ * legal Java identifier.
+ */
+ private Name name = null;
+
+ /**
+ * Creates a new AST node for a module qualified name owned by the given AST.
+ * <p>
+ * N.B. This constructor is package-private; all subclasses must be
+ * declared in the same package; clients are unable to declare
+ * additional subclasses.
+ * </p>
+ *
+ * @param ast the AST that is to own this node
+ */
+ ModuleQualifiedName(AST ast) {
+ super(ast);
+ unsupportedBelow15();
+ }
+
+ @Override
+ final List internalStructuralPropertiesForType(int apiLevel) {
+ return propertyDescriptors(apiLevel);
+ }
+
+ @Override
+ final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {
+ if (property == MODULE_QUALIFIER_PROPERTY) {
+ if (get) {
+ return getModuleQualifier();
+ } else {
+ setModuleQualifier((SimpleName) child);
+ return null;
+ }
+ }
+ if (property == NAME_PROPERTY) {
+ if (get) {
+ return getName();
+ } else {
+ setName((QualifiedName) child);
+ return null;
+ }
+ }
+ // allow default implementation to flag the error
+ return super.internalGetSetChildProperty(property, get, child);
+ }
+
+ @Override
+ final int getNodeType0() {
+ return MODULE_QUALIFIED_NAME;
+ }
+
+ @Override
+ ASTNode clone0(AST target) {
+ ModuleQualifiedName result = new ModuleQualifiedName(target);
+ result.setSourceRange(getStartPosition(), getLength());
+ result.setModuleQualifier((SimpleName) getModuleQualifier().clone(target));
+ result.setName((QualifiedName) getName().clone(target));
+ return result;
+ }
+
+ @Override
+ final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
+ // dispatch to correct overloaded match method
+ return matcher.match(this, other);
+ }
+
+ @Override
+ void accept0(ASTVisitor visitor) {
+ boolean visitChildren = visitor.visit(this);
+ if (visitChildren) {
+ // visit children in normal left to right reading order
+ acceptChild(visitor, getModuleQualifier());
+ acceptChild(visitor, getName());
+ }
+ visitor.endVisit(this);
+ }
+
+ /**
+ * Returns the qualifier part of this qualified name.
+ *
+ * @return the qualifier part of this qualified name
+ */
+ public Name getModuleQualifier() {
+ if (this.moduleQualifier == null) {
+ // lazy init must be thread-safe for readers
+ synchronized (this) {
+ if (this.moduleQualifier == null) {
+ preLazyInit();
+ this.moduleQualifier = new SimpleName(this.ast);
+ postLazyInit(this.moduleQualifier, MODULE_QUALIFIER_PROPERTY);
+ }
+ }
+ }
+ return this.moduleQualifier;
+ }
+
+ /**
+ * Sets the qualifier of this qualified name to the given name.
+ *
+ * @param moduleQualifier the qualifier of this qualified name
+ * @exception IllegalArgumentException if:
+ * <ul>
+ * <li>the node belongs to a different AST</li>
+ * <li>the node already has a parent</li>
+ * <li>a cycle in would be created</li>
+ * </ul>
+ */
+ public void setModuleQualifier(Name moduleQualifier) {
+ if (moduleQualifier == null) {
+ throw new IllegalArgumentException();
+ }
+ ASTNode oldChild = this.moduleQualifier;
+ preReplaceChild(oldChild, moduleQualifier, MODULE_QUALIFIER_PROPERTY);
+ this.moduleQualifier = moduleQualifier;
+ postReplaceChild(oldChild, moduleQualifier, MODULE_QUALIFIER_PROPERTY);
+ }
+
+ /**
+ * Returns the name part of this qualified name.
+ *
+ * @return the name being qualified
+ */
+ public Name getName() {
+ return this.name;
+ }
+
+ /**
+ * Sets the name part of this qualified name to the given simple name.
+ *
+ * @param name the identifier of this qualified name
+ * @exception IllegalArgumentException if:
+ * <ul>
+ * <li>the node belongs to a different AST</li>
+ * <li>the node already has a parent</li>
+ * </ul>
+ */
+ public void setName(Name name) {
+ ASTNode oldChild = this.name;
+ preReplaceChild(oldChild, name, NAME_PROPERTY);
+ this.name = name;
+ postReplaceChild(oldChild, name, NAME_PROPERTY);
+ }
+
+ @Override
+ void appendName(StringBuffer buffer) {
+ getModuleQualifier().appendName(buffer);
+ buffer.append('/');
+ if (getName() != null) {
+ getName().appendName(buffer);
+ }
+ }
+
+ @Override
+ int memSize() {
+ return BASE_NAME_NODE_SIZE + 3 * 4;
+ }
+
+ @Override
+ int treeSize() {
+ return
+ memSize()
+ + (this.name == null ? 0 : getName().treeSize())
+ + (this.moduleQualifier == null ? 0 : getModuleQualifier().treeSize());
+ }
+}
+
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
index bd619dd61a..4ec090df74 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
@@ -174,7 +174,7 @@ public class RecordDeclaration extends AbstractTypeDeclaration {
* @since 3.22
*/
public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
- if (apiLevel == AST.JLS14_INTERNAL && previewEnabled) {
+ if (apiLevel == AST.JLS15_INTERNAL && previewEnabled) {
return PROPERTY_DESCRIPTORS;
}
return null;
@@ -218,12 +218,12 @@ public class RecordDeclaration extends AbstractTypeDeclaration {
* </p>
*
* @param ast the AST that is to own this node
- * @exception UnsupportedOperationException if this operation is used other than JLS14
+ * @exception UnsupportedOperationException if this operation is used other than JLS15
* @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
*/
RecordDeclaration(AST ast) {
super(ast);
- supportedOnlyIn14();
+ supportedOnlyIn15();
unsupportedWithoutPreviewError();
}
@@ -455,7 +455,7 @@ public class RecordDeclaration extends AbstractTypeDeclaration {
@Override
int memSize() {
- return super.memSize() + 8 * 4;
+ return super.memSize() + 4 * 4;
}
@Override
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java
index cfa1220ebf..1d2de52904 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -136,7 +136,7 @@ public class SwitchCase extends Statement {
*/
SwitchCase(AST ast) {
super(ast);
- if (ast.apiLevel >= AST.JLS14) {
+ if (ast.apiLevel >= AST.JLS14_INTERNAL) {
this.expressions = new ASTNode.NodeList(EXPRESSIONS2_PROPERTY );
}
}
@@ -194,7 +194,7 @@ public class SwitchCase extends Statement {
SwitchCase result = new SwitchCase(target);
result.setSourceRange(getStartPosition(), getLength());
result.copyLeadingComment(this);
- if (this.ast.apiLevel >= AST.JLS14) {
+ if (this.ast.apiLevel >= AST.JLS14_INTERNAL) {
result.expressions().addAll(
ASTNode.copySubtrees(target, expressions()));
} else {
@@ -214,7 +214,7 @@ public class SwitchCase extends Statement {
void accept0(ASTVisitor visitor) {
boolean visitChildren = visitor.visit(this);
if (visitChildren) {
- if (this.ast.apiLevel >= AST.JLS14) {
+ if (this.ast.apiLevel >= AST.JLS14_INTERNAL) {
acceptChildren(visitor, this.expressions);
} else {
acceptChild(visitor, getExpression());
@@ -323,7 +323,7 @@ public class SwitchCase extends Statement {
* <code>false</code> if this is a non-default switch case
*/
public boolean isDefault() {
- if (this.ast.apiLevel >= AST.JLS14) {
+ if (this.ast.apiLevel >= AST.JLS14_INTERNAL) {
return expressions().isEmpty();
}
return getExpression() == null;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java
index 77d11c8a99..5602a229b5 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 IBM Corporation and others.
+ * Copyright (c) 2019, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,9 +28,7 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
*
* These are block of String literal nodes.
*
- * @since 3.20
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noreference This class is not intended to be referenced by clients as it is a part of Java preview feature.
+ * @since 3.22
*/
@SuppressWarnings("rawtypes")
public class TextBlock extends Expression {
@@ -65,31 +63,13 @@ public class TextBlock extends Expression {
* @return a list of property descriptors (element type:
* {@link StructuralPropertyDescriptor})
- * @since 3.0
+ * @since 3.23
*/
public static List propertyDescriptors(int apiLevel) {
- return propertyDescriptors(apiLevel, false);
+ return PROPERTY_DESCRIPTORS;
}
/**
- * Returns a list of structural property descriptors for this node type.
- * Clients must not modify the result.
- *
- * @param apiLevel the API level; one of the
- * <code>AST.JLS*</code> constants
- * @param previewEnabled the previewEnabled flag
- * @return a list of property descriptors (element type:
- * {@link StructuralPropertyDescriptor})
- * @noreference This method is not intended to be referenced by clients.
- * @since 3.20
- */
- public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
- if (apiLevel == AST.JLS14_INTERNAL && previewEnabled) {
- return PROPERTY_DESCRIPTORS;
- }
- return null;
- }
- /**
* The literal string, including quotes and escapes; defaults to the
* literal for the empty string.
*/
@@ -103,13 +83,11 @@ public class TextBlock extends Expression {
* </p>
*
* @param ast the AST that is to own this node
- * @exception UnsupportedOperationException if this operation is used other than JLS14
- * @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
+ * @exception UnsupportedOperationException if this operation is used beloe JLS15
*/
TextBlock(AST ast) {
super(ast);
- supportedOnlyIn14();
- unsupportedWithoutPreviewError();
+ unsupportedBelow15();
}
@Override
@@ -118,11 +96,6 @@ public class TextBlock extends Expression {
}
@Override
- final List internalStructuralPropertiesForType(int apiLevel, boolean previewEnabled) {
- return propertyDescriptors(apiLevel, previewEnabled);
- }
-
- @Override
final Object internalGetSetObjectProperty(SimplePropertyDescriptor property, boolean get, Object value) {
if (property == ESCAPED_VALUE_PROPERTY) {
if (get) {
@@ -169,6 +142,7 @@ public class TextBlock extends Expression {
*
* @return the string literal token, including enclosing double
* quotes and embedded escapes
+ * @since 3.23
*/
public String getEscapedValue() {
return this.escapedValue;
@@ -188,6 +162,7 @@ public class TextBlock extends Expression {
* @param token the string literal token, including enclosing double
* quotes and embedded escapes
* @exception IllegalArgumentException if the argument is incorrect
+ * @since 3.23
*/
public void setEscapedValue(String token) {
// update internalSetEscapedValue(String) if this is changed
@@ -239,6 +214,7 @@ public class TextBlock extends Expression {
*
* @return the string value without enclosing triple quotes
* @exception IllegalArgumentException if the literal value cannot be converted
+ * @since 3.23
*/
public String getLiteralValue() {
char[] escaped = getEscapedValue().toCharArray();
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
index b6071d5ab6..57c1325f53 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,6 +18,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.jdt.internal.core.dom.util.DOMASTUtil;
+
/**
* Type declaration AST node type. A type declaration
* is the union of a class declaration and an interface declaration.
@@ -31,11 +33,13 @@ import java.util.List;
* [ <b>&lt;</b> TypeParameter { <b>,</b> TypeParameter } <b>&gt;</b> ]
* [ <b>extends</b> Type ]
* [ <b>implements</b> Type { <b>,</b> Type } ]
+ * [ <b>permits</b> Type { <b>,</b> Type } ]
* <b>{</b> { ClassBodyDeclaration | <b>;</b> } <b>}</b>
* InterfaceDeclaration:
* [ Javadoc ] { ExtendedModifier } <b>interface</b> Identifier
* [ <b>&lt;</b> TypeParameter { <b>,</b> TypeParameter } <b>&gt;</b> ]
* [ <b>extends</b> Type { <b>,</b> Type } ]
+ * [ <b>permits</b> Type { <b>,</b> Type } ]
* <b>{</b> { InterfaceBodyDeclaration | <b>;</b> } <b>}</b>
* </pre>
* <p>
@@ -135,6 +139,15 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
internalBodyDeclarationPropertyFactory(TypeDeclaration.class);
/**
+ * The "permitsTypes" structural property of this node type (element type: {@link Type}) (added in JLS15 API).
+ * @since 3.23
+ */
+ public static final ChildListPropertyDescriptor PERMITS_TYPES_PROPERTY =
+ new ChildListPropertyDescriptor(TypeDeclaration.class, "permitsTypes", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$
+
+
+
+ /**
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
@@ -150,6 +163,14 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
*/
private static final List PROPERTY_DESCRIPTORS_3_0;
+ /**
+ * A list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor}),
+ * or null if uninitialized.
+ * @since 3.22
+ */
+ private static final List PROPERTY_DESCRIPTORS_15;
+
static {
List propertyList = new ArrayList(8);
createPropertyList(TypeDeclaration.class, propertyList);
@@ -173,6 +194,19 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
addProperty(SUPER_INTERFACE_TYPES_PROPERTY, propertyList);
addProperty(BODY_DECLARATIONS_PROPERTY, propertyList);
PROPERTY_DESCRIPTORS_3_0 = reapPropertyList(propertyList);
+
+ propertyList = new ArrayList(10);
+ createPropertyList(TypeDeclaration.class, propertyList);
+ addProperty(JAVADOC_PROPERTY, propertyList);
+ addProperty(MODIFIERS2_PROPERTY, propertyList);
+ addProperty(INTERFACE_PROPERTY, propertyList);
+ addProperty(NAME_PROPERTY, propertyList);
+ addProperty(TYPE_PARAMETERS_PROPERTY, propertyList);
+ addProperty(SUPERCLASS_TYPE_PROPERTY, propertyList);
+ addProperty(SUPER_INTERFACE_TYPES_PROPERTY, propertyList);
+ addProperty(PERMITS_TYPES_PROPERTY, propertyList);
+ addProperty(BODY_DECLARATIONS_PROPERTY, propertyList);
+ PROPERTY_DESCRIPTORS_15 = reapPropertyList(propertyList);
}
/**
@@ -195,6 +229,27 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
}
/**
+ * Returns a list of structural property descriptors for this node type.
+ * Clients must not modify the result.
+ *
+ * @param apiLevel the API level; one of the
+ * <code>AST.JLS*</code> constants
+ * @param previewEnabled the previewEnabled flag
+ * @return a list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor})
+ * @noreference This method is not intended to be referenced by clients.
+ * @since 3.22
+ */
+ public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
+ if (DOMASTUtil.isFeatureSupportedinAST(apiLevel, previewEnabled, Modifier.SEALED)) {
+ return PROPERTY_DESCRIPTORS_15;
+ } else if (apiLevel == AST.JLS2_INTERNAL) {
+ return PROPERTY_DESCRIPTORS_2_0;
+ }
+ return PROPERTY_DESCRIPTORS_3_0;
+ }
+
+ /**
* <code>true</code> for an interface, <code>false</code> for a class.
* Defaults to class.
*/
@@ -240,6 +295,14 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
private ASTNode.NodeList superInterfaceTypes = null;
/**
+ * The permits types (element type: {@link Type}).
+ * Not Null from Java 15 with oreview; defaults to an empty list
+ * (see constructor).
+ * @since 3.22
+ */
+ private ASTNode.NodeList permittedTypes = null;
+
+ /**
* Creates a new AST node for a type declaration owned by the given
* AST. By default, the type declaration is for a class of an
* unspecified, but legal, name; no modifiers; no javadoc;
@@ -262,6 +325,9 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
this.typeParameters = new ASTNode.NodeList(TYPE_PARAMETERS_PROPERTY);
this.superInterfaceTypes = new ASTNode.NodeList(SUPER_INTERFACE_TYPES_PROPERTY);
}
+ if (DOMASTUtil.isFeatureSupportedinAST(ast, Modifier.SEALED)) {
+ this.permittedTypes = new ASTNode.NodeList(PERMITS_TYPES_PROPERTY);
+ }
}
/* (omit javadoc for this method)
@@ -274,6 +340,11 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
}
@Override
+ final List internalStructuralPropertiesForType(int apiLevel, boolean previewEnabled) {
+ return propertyDescriptors(apiLevel, previewEnabled);
+ }
+
+ @Override
final int internalGetSetIntProperty(SimplePropertyDescriptor property, boolean get, int value) {
if (property == MODIFIERS_PROPERTY) {
if (get) {
@@ -353,6 +424,9 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
if (property == SUPER_INTERFACE_TYPES_PROPERTY) {
return superInterfaceTypes();
}
+ if (property == PERMITS_TYPES_PROPERTY) {
+ return permittedTypes();
+ }
if (property == BODY_DECLARATIONS_PROPERTY) {
return bodyDeclarations();
}
@@ -414,6 +488,11 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
result.superInterfaceTypes().addAll(
ASTNode.copySubtrees(target, superInterfaceTypes()));
}
+ if (DOMASTUtil.isFeatureSupportedinAST(this.ast, Modifier.SEALED)) {
+ result.permittedTypes().addAll(
+ ASTNode.copySubtrees(target, permittedTypes()));
+ result.restrictedIdentifierStartPosition = getRestrictedIdentifierStartPosition();
+ }
result.bodyDeclarations().addAll(
ASTNode.copySubtrees(target, bodyDeclarations()));
return result;
@@ -446,6 +525,9 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
acceptChildren(visitor, this.superInterfaceTypes);
acceptChildren(visitor, this.bodyDeclarations);
}
+ if (DOMASTUtil.isFeatureSupportedinAST(getAST(), Modifier.SEALED)) {
+ acceptChildren(visitor, this.permittedTypes);
+ }
}
visitor.endVisit(this);
}
@@ -662,6 +744,26 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
}
/**
+ * Returns the live ordered list of permits of this type
+ * declaration (added in JLS15 API). For a type declaration, these are the
+ * permitted types which can implement/extend this sealed type.
+ *
+ *
+ * @return the live list of types
+ * (element type: {@link Type})
+ * @exception UnsupportedOperationException if this operation is not used with Java 15 and preview enabled
+ * @since 3.23
+ */
+ public List permittedTypes() {
+ // more efficient than just calling unsupportedIn2() to check
+ if (this.permittedTypes == null) {
+ supportedOnlyIn15();
+ unsupportedWithoutPreviewError();
+ }
+ return this.permittedTypes;
+ }
+
+ /**
* Returns the ordered list of field declarations of this type
* declaration. For a class declaration, these are the
* field declarations; for an interface declaration, these are
@@ -761,7 +863,8 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
@Override
int memSize() {
- return super.memSize() + 6 * 4;
+ // there are 7 fields that are either int or pointer and one boolean type
+ return super.memSize() + 1 + (7 * 4) ;
}
@Override
@@ -775,7 +878,40 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
+ (this.optionalSuperclassType == null ? 0 : getSuperclassType().treeSize())
+ (this.superInterfaceNames == null ? 0 : this.superInterfaceNames.listSize())
+ (this.superInterfaceTypes == null ? 0 : this.superInterfaceTypes.listSize())
+ + (this.permittedTypes == null ? 0 : this.permittedTypes.listSize())
+ this.bodyDeclarations.listSize();
}
+
+ /**
+ * A character index into the original restricted identifier source string, or <code>-1</code> if no restricted
+ * identifier source position information is available for this node; <code>-1</code> by default.
+ */
+ private int restrictedIdentifierStartPosition = -1;
+
+ /**
+ * A character index into the original restricted identifier source string, or <code>-1</code> if no restricted
+ * identifier source position information is available for this node; <code>-1</code> by default.
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void setRestrictedIdentifierStartPosition(int restrictedIdentifierStartPosition) {
+ if (restrictedIdentifierStartPosition < 0) {
+ throw new IllegalArgumentException();
+ }
+ // restrictedIdentifierStartPosition is not considered a structural property
+ // but we protect it nevertheless
+ checkModifiable();
+ this.restrictedIdentifierStartPosition = restrictedIdentifierStartPosition;
+ }
+
+ /**
+ * A character index into the original restricted identifier source string, or <code>-1</code> if no restricted
+ * identifier source position information is available for this node; <code>-1</code> by default.
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public int getRestrictedIdentifierStartPosition() {
+ return this.restrictedIdentifierStartPosition;
+ }
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
index 039ba29027..c330b62155 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1317,7 +1317,7 @@ public final class ImportRewrite {
CompilationUnit usedAstRoot= this.astRoot;
if (usedAstRoot == null) {
- ASTParser parser= ASTParser.newParser(AST.JLS14);
+ ASTParser parser= ASTParser.newParser(AST.JLS15);
parser.setSource(this.compilationUnit);
parser.setFocalPosition(0); // reduced AST
parser.setResolveBindings(false);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
index f04b9d9bd3..06575f5a47 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
@@ -84,6 +84,14 @@ public class NaiveASTFlattener extends ASTVisitor {
private static final int JLS9 = AST.JLS9;
/**
+ * Internal synonym for {@link AST#JLS14}. Use to alleviate
+ * deprecation warnings.
+ * @deprecated
+ * @since 3.22
+ */
+ private static final int JLS14 = AST.JLS14;
+
+ /**
* The string buffer into which the serialized representation of the AST is
* written.
*/
@@ -202,6 +210,12 @@ public class NaiveASTFlattener extends ASTVisitor {
if (Modifier.isTransient(modifiers)) {
this.buffer.append("transient ");//$NON-NLS-1$
}
+ if (Modifier.isSealed(modifiers)) {
+ this.buffer.append("sealed ");//$NON-NLS-1$
+ }
+ if (Modifier.isNonSealed(modifiers)) {
+ this.buffer.append("non-sealed ");//$NON-NLS-1$
+ }
}
/**
@@ -1289,6 +1303,17 @@ public class NaiveASTFlattener extends ASTVisitor {
}
@Override
+ public boolean visit(ModuleQualifiedName node) {
+ node.getModuleQualifier().accept(this);
+ this.buffer.append("/");//$NON-NLS-1$
+ ASTNode cNode = node.getName();
+ if (cNode != null) {
+ cNode.accept(this);
+ }
+ return false;
+ }
+
+ @Override
public boolean visit(QualifiedName node) {
node.getQualifier().accept(this);
this.buffer.append(".");//$NON-NLS-1$
@@ -1550,7 +1575,7 @@ public class NaiveASTFlattener extends ASTVisitor {
@Override
public boolean visit(SwitchCase node) {
- if ((node.getAST().apiLevel() >= AST.JLS14)) {
+ if ((node.getAST().apiLevel() >= JLS14)) {
if (node.isDefault()) {
this.buffer.append("default");//$NON-NLS-1$
this.buffer.append(node.isSwitchLabeledRule() ? " ->" : ":");//$NON-NLS-1$ //$NON-NLS-2$
@@ -1800,6 +1825,19 @@ public class NaiveASTFlattener extends ASTVisitor {
this.buffer.append(" ");//$NON-NLS-1$
}
}
+ if (DOMASTUtil.isFeatureSupportedinAST(node.getAST(), Modifier.SEALED)) {
+ if (!node.permittedTypes().isEmpty()) {
+ this.buffer.append("permits ");//$NON-NLS-1$
+ for (Iterator it = node.permittedTypes().iterator(); it.hasNext(); ) {
+ Type t = (Type) it.next();
+ t.accept(this);
+ if (it.hasNext()) {
+ this.buffer.append(", ");//$NON-NLS-1$
+ }
+ }
+ this.buffer.append(" ");//$NON-NLS-1$
+ }
+ }
this.buffer.append("{\n");//$NON-NLS-1$
this.indent++;
for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
@@ -1975,7 +2013,7 @@ public class NaiveASTFlattener extends ASTVisitor {
@Override
public boolean visit(YieldStatement node) {
- if ((node.getAST().apiLevel() >= AST.JLS14) && node.isImplicit() && node.getExpression() == null) {
+ if ((node.getAST().apiLevel() >= JLS14) && node.isImplicit() && node.getExpression() == null) {
return false;
}
printIndent();
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index 13d399299c..2c0cef0263 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -138,6 +138,8 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
/** @deprecated using deprecated code */
private static final int JLS9_INTERNAL = AST.JLS9;
+ /** @deprecated using deprecated code */
+ private static final int JLS14_INTERNAL = AST.JLS14;
TextEdit currentEdit;
final RewriteEventStore eventStore; // used from inner classes
@@ -1567,6 +1569,8 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
case TerminalTokens.TokenNamestrictfp: keep= Modifier.isStrictfp(newModifiers); break;
case TerminalTokens.TokenNametransient: keep= Modifier.isTransient(newModifiers); break;
case TerminalTokens.TokenNamesynchronized: keep= Modifier.isSynchronized(newModifiers); break;
+ case TerminalTokens.TokenNameRestrictedIdentifiersealed: keep= Modifier.isSealed(newModifiers); break;
+ case TerminalTokens.TokenNamenon_sealed: keep= Modifier.isNonSealed(newModifiers); break;
default:
break loop;
}
@@ -1945,6 +1949,18 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
pos= rewriteNodeList(node, superInterfaceProperty, pos, keyword, ", "); //$NON-NLS-1$
}
+ if (DOMASTUtil.isFeatureSupportedinAST(node.getAST(), Modifier.SEALED)) {
+ // permits for sealed
+ ChildListPropertyDescriptor permitsProperty= TypeDeclaration.PERMITS_TYPES_PROPERTY;
+
+ RewriteEvent permitsEvent= getEvent(node, permitsProperty);
+ if (permitsEvent == null || permitsEvent.getChangeKind() == RewriteEvent.UNCHANGED) {
+ pos= doVisit(node, permitsProperty, pos);
+ } else {
+ pos= rewriteNodeList(node, permitsProperty, pos, " permits ", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
// type members
// startPos : find position after left brace of type, be aware that bracket might be missing
int startIndent= getIndent(node.getStartPosition()) + 1;
@@ -3580,7 +3596,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
}
// dont allow switching from case to default or back. New statements should be created.
- if (node.getAST().apiLevel() >= AST.JLS14) {
+ if (node.getAST().apiLevel() >= JLS14_INTERNAL) {
int pos = node.expressions().size() == 0 ? node.getStartPosition() :
rewriteNodeList(node, SwitchCase.EXPRESSIONS2_PROPERTY, node.getStartPosition(), Util.EMPTY_STRING, ", "); //$NON-NLS-1$
if (isChanged(node, SwitchCase.SWITCH_LABELED_RULE_PROPERTY)) {
@@ -3804,7 +3820,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
insertIndent++;
}
ParagraphListRewriter listRewriter;
- if ((node.getAST().apiLevel() >= AST.JLS14)) {
+ if ((node.getAST().apiLevel() >= JLS14_INTERNAL)) {
listRewriter= new SwitchListLabeledRuleRewriter(insertIndent);
} else {
listRewriter= new SwitchListRewriter(insertIndent);
@@ -4551,7 +4567,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
try {
int offset= getScanner().getTokenEndOffset(TerminalTokens.TokenNamebreak, node.getStartPosition());
- if ((node.getAST().apiLevel() >= AST.JLS14)) {
+ if ((node.getAST().apiLevel() >= JLS14_INTERNAL)) {
rewriteNode(node, YieldStatement.EXPRESSION_PROPERTY, offset, ASTRewriteFormatter.SPACE); // space between yield and label
}
} catch (CoreException e) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
index 5b8443ae19..7474baa340 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
@@ -95,6 +95,9 @@ public class ASTRewriteFlattener extends ASTVisitor {
/** @deprecated using deprecated code */
private static final int JLS9_INTERNAL = AST.JLS9;
+ /** @deprecated using deprecated code */
+ private static final int JLS14_INTERNAL = AST.JLS14;
+
public static String asString(ASTNode node, RewriteEventStore store) {
ASTRewriteFlattener flattener= new ASTRewriteFlattener(store);
node.accept(flattener);
@@ -165,6 +168,12 @@ public class ASTRewriteFlattener extends ASTVisitor {
if (Modifier.isTransient(modifiers)) {
buf.append("transient "); //$NON-NLS-1$
}
+ if (Modifier.isSealed(modifiers)) {
+ buf.append("sealed ");//$NON-NLS-1$
+ }
+ if (Modifier.isNonSealed(modifiers)) {
+ buf.append("non-sealed ");//$NON-NLS-1$
+ }
}
@@ -995,7 +1004,7 @@ public class ASTRewriteFlattener extends ASTVisitor {
@Override
public boolean visit(SwitchCase node) {
- if ((node.getAST().apiLevel() >= AST.JLS14)) {
+ if ((node.getAST().apiLevel() >= JLS14_INTERNAL)) {
if (node.isDefault()) {
this.result.append("default");//$NON-NLS-1$
this.result.append(getBooleanAttribute(node, SwitchCase.SWITCH_LABELED_RULE_PROPERTY) ? " ->" : ":");//$NON-NLS-1$ //$NON-NLS-2$
@@ -1135,6 +1144,11 @@ public class ASTRewriteFlattener extends ASTVisitor {
ChildListPropertyDescriptor superInterfaceProperty= (apiLevel == JLS2_INTERNAL) ? INTERNAL_TYPE_SUPER_INTERFACES_PROPERTY : TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY;
String lead= isInterface ? "extends " : "implements "; //$NON-NLS-1$//$NON-NLS-2$
visitList(node, superInterfaceProperty, String.valueOf(','), lead, Util.EMPTY_STRING);
+
+
+ if (DOMASTUtil.isFeatureSupportedinAST(node.getAST(), Modifier.SEALED) && !node.permittedTypes().isEmpty()) {
+ visitList(node, TypeDeclaration.PERMITS_TYPES_PROPERTY, String.valueOf(','), lead, Util.EMPTY_STRING);
+ }
this.result.append('{');
visitList(node, TypeDeclaration.BODY_DECLARATIONS_PROPERTY, null);
this.result.append('}');
@@ -1530,7 +1544,7 @@ public class ASTRewriteFlattener extends ASTVisitor {
@Override
public boolean visit(YieldStatement node) {
- if (node.getAST().apiLevel() >= AST.JLS14 && node.isImplicit() && node.getExpression() == null) {
+ if (node.getAST().apiLevel() >= JLS14_INTERNAL && node.isImplicit() && node.getExpression() == null) {
return false;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
index e01136b4ad..aeb33e7f34 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
@@ -16,6 +16,7 @@ package org.eclipse.jdt.internal.core.dom.util;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Modifier;
public class DOMASTUtil {
@@ -52,12 +53,14 @@ public class DOMASTUtil {
* @see ASTNode#getNodeType()
* @since 3.22
*/
+ @SuppressWarnings("deprecation")
private static boolean isNodeTypeSupportedinAST(int apiLevel, boolean previewEnabled, int nodeType) {
switch (nodeType) {
case ASTNode.SWITCH_EXPRESSION:
case ASTNode.YIELD_STATEMENT:
return apiLevel >= AST.JLS14;
case ASTNode.TEXT_BLOCK:
+ return apiLevel >= AST.JLS15;
case ASTNode.RECORD_DECLARATION:
case ASTNode.INSTANCEOF_EXPRESSION:
return isPreviewEnabled(apiLevel, previewEnabled);
@@ -65,8 +68,54 @@ public class DOMASTUtil {
return false;
}
+ /**
+ * Validates if the given <code>apiLevel</code> and <code>previewEnabled</code> supports the provided
+ * <code>nodeType</code>. This API checks for node types supported from JLS 14 onwards and will return
+ * <code>true></code> for nodes added before JLS14.
+ *
+ * @param ast
+ * the AST to be evaluated
+ * @param featureName
+ * the feature name constant indicating the feature to be evaluated
+ * @return <code>true</code> if the given <code>AST</code> supports the provided <code>nodeType</code> else
+ * <code>false</code>
+ * @see ASTNode#getNodeType()
+ * @since 3.22
+ */
+ public static boolean isFeatureSupportedinAST(AST ast, int featureName) {
+ switch (featureName) {
+ case Modifier.SEALED:
+ return isPreviewEnabled(ast.apiLevel(), ast.isPreviewEnabledSet());
+ }
+ return false;
+ }
+
+ /**
+ * Validates if the given <code>apiLevel</code> and <code>previewEnabled</code> supports the provided
+ * <code>nodeType</code>. This API checks for node types supported from JLS 14 onwards and will return
+ * <code>true></code> for nodes added before JLS14.
+ *
+ * @param apiLevel
+ * the level to be checked
+ * @param previewEnabled
+ * the preview feature to be considered
+ * @param featureName
+ * the feature name constant indicating the feature to be evaluated
+ * @return <code>true</code> if the given <code>AST</code> supports the provided <code>nodeType</code> else
+ * <code>false</code>
+ * @see ASTNode#getNodeType()
+ * @since 3.22
+ */
+ public static boolean isFeatureSupportedinAST(int apiLevel, boolean previewEnabled, int featureName) {
+ switch (featureName) {
+ case Modifier.SEALED:
+ return isPreviewEnabled(apiLevel, previewEnabled);
+ }
+ return false;
+ }
+
private static boolean isPreviewEnabled(int apiLevel, boolean previewEnabled) {
- return (apiLevel == AST.JLS14 && previewEnabled);
+ return (apiLevel == AST.JLS15 && previewEnabled);
}
public static boolean isSwitchExpressionSupported(AST ast) {
@@ -97,6 +146,10 @@ public class DOMASTUtil {
return isNodeTypeSupportedinAST(apiLevel, previewEnabled, ASTNode.INSTANCEOF_EXPRESSION);
}
+ public static boolean isSealedTypeSupported(AST ast) {
+ return isNodeTypeSupportedinAST(ast, ASTNode.INSTANCEOF_EXPRESSION);
+ }
+
@SuppressWarnings("deprecation")
public static void checkASTLevel(int level) {
switch (level) {
@@ -110,6 +163,7 @@ public class DOMASTUtil {
case AST.JLS12 :
case AST.JLS13 :
case AST.JLS14 :
+ case AST.JLS15 :
return;
}
throw new IllegalArgumentException();
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
index 06dc1f8093..45d19d31aa 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,6 +28,7 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus;
@@ -226,6 +227,10 @@ public boolean isLocal() {
return false;
}
@Override
+public boolean isRecord() {
+ return false;
+}
+@Override
public boolean isMember() {
return false;
}
@@ -246,4 +251,8 @@ public char[] getModule() {
public ExternalAnnotationStatus getExternalAnnotationStatus() {
return ExternalAnnotationStatus.NOT_EEA_CONFIGURED;
}
+@Override
+public IRecordComponent[] getRecordComponents() {
+ return null;
+}
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
index 6d94c6824f..bbfca36b41 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
@@ -127,14 +127,14 @@ public class DefaultCodeFormatter extends CodeFormatter {
this.workingOptions = new DefaultCodeFormatterOptions(options);
this.oldCommentFormatOption = getOldCommentFormatOption(options);
String compilerSource = options.get(CompilerOptions.OPTION_Source);
- this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_14;
+ this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_15;
this.previewEnabled = JavaCore.ENABLED.equals(options.get(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES));
} else {
Map<String, String> settings = DefaultCodeFormatterConstants.getJavaConventionsSettings();
this.originalOptions = new DefaultCodeFormatterOptions(settings);
this.workingOptions = new DefaultCodeFormatterOptions(settings);
this.oldCommentFormatOption = DefaultCodeFormatterConstants.TRUE;
- this.sourceLevel = CompilerOptions.VERSION_14;
+ this.sourceLevel = CompilerOptions.VERSION_15;
}
if (defaultCodeFormatterOptions != null) {
this.originalOptions.set(defaultCodeFormatterOptions.getMap());
@@ -334,7 +334,7 @@ public class DefaultCodeFormatter extends CodeFormatter {
}
private ASTParser createParser(int kind) {
- ASTParser parser = ASTParser.newParser(AST.JLS14);
+ ASTParser parser = ASTParser.newParser(AST.JLS15);
if (kind == K_MODULE_INFO) {
parser.setSource(createDummyModuleInfoCompilationUnit());
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
index d6e62fe30c..d075602cac 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
@@ -92,6 +92,13 @@ public class LineBreaksPreparator extends ASTVisitor {
private boolean declarationModifierVisited;
+ /**
+ * Internal synonym for constant AST.JSL14
+ * to alleviate deprecation warnings once AST.JLS14 is deprecated in future.
+ * @deprecated
+ */
+ private static final int AST_INTERNAL_JLS14 = AST.JLS14;
+
public LineBreaksPreparator(TokenManager tokenManager, DefaultCodeFormatterOptions options) {
this.tm = tokenManager;
this.options = options;
@@ -406,7 +413,7 @@ public class LineBreaksPreparator extends ASTVisitor {
private void doSwitchStatementsLineBreaks(List<Statement> statements) {
boolean arrowMode = statements.stream()
- .anyMatch(s -> s instanceof SwitchCase && s.getAST().apiLevel() >= AST.JLS14 &&((SwitchCase) s).isSwitchLabeledRule());
+ .anyMatch(s -> s instanceof SwitchCase && s.getAST().apiLevel() >= AST_INTERNAL_JLS14 &&((SwitchCase) s).isSwitchLabeledRule());
Statement previous = null;
for (Statement statement : statements) {
boolean skip = statement instanceof Block // will add break in visit(Block) if necessary
diff --git a/org.eclipse.jdt.core/grammar/java.g b/org.eclipse.jdt.core/grammar/java.g
index 7b6d45b7c1..1bd22c7bb4 100644
--- a/org.eclipse.jdt.core/grammar/java.g
+++ b/org.eclipse.jdt.core/grammar/java.g
@@ -45,7 +45,7 @@ $Terminals
abstract assert boolean break byte case catch char class
continue const default do double else enum extends false final finally float
for goto if implements import instanceof int
- interface long native new null package private
+ interface long native new non-sealed null package private
protected public return short static strictfp super switch
synchronized this throw throws transient true try void
volatile while module open requires transitive exports opens to uses provides with
@@ -117,6 +117,8 @@ $Terminals
BeginCaseExpr
RestrictedIdentifierYield
RestrictedIdentifierrecord
+ RestrictedIdentifiersealed
+ RestrictedIdentifierpermits
-- BodyMarker
@@ -222,6 +224,10 @@ Goal ::= '@' TypeAnnotations
-- JSR 354 Reconnaissance mission.
Goal ::= '->' YieldStatement
Goal ::= '->' SwitchLabelCaseLhs
+-- JSR 360 Restricted
+Goal ::= RestrictedIdentifiersealed Modifiersopt
+Goal ::= RestrictedIdentifierpermits PermittedSubclasses
+
/:$readableName Goal:/
Literal -> IntegerLiteral
@@ -662,6 +668,8 @@ Modifier -> 'static'
Modifier -> 'abstract'
Modifier -> 'final'
Modifier -> 'native'
+Modifier -> 'non-sealed'
+Modifier -> RestrictedIdentifiersealed
Modifier -> 'synchronized'
Modifier -> 'transient'
Modifier -> 'volatile'
@@ -675,13 +683,14 @@ Modifier ::= Annotation
-- 'abstract'
-- | 'final'
-- | 'public'
+-- | 'non-sealed'
--18.8.1 Productions from 8.1: Class Declarations
ClassDeclaration ::= ClassHeader ClassBody
/.$putCase consumeClassDeclaration(); $break ./
/:$readableName ClassDeclaration:/
-ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt
+ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt ClassHeaderPermittedSubclassesopt
/.$putCase consumeClassHeader(); $break ./
/:$readableName ClassHeader:/
@@ -1022,12 +1031,13 @@ ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'this' '(' Argument
--InterfaceModifier ::=
-- 'public'
-- | 'abstract'
+-- | 'non-sealed'
--
InterfaceDeclaration ::= InterfaceHeader InterfaceBody
/.$putCase consumeInterfaceDeclaration(); $break ./
/:$readableName InterfaceDeclaration:/
-InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt
+InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt InterfaceHeaderPermittedSubClassesAndSubInterfacesopt
/.$putCase consumeInterfaceHeader(); $break ./
/:$readableName InterfaceHeader:/
@@ -2253,6 +2263,30 @@ ClassHeaderImplementsopt ::= $empty
ClassHeaderImplementsopt -> ClassHeaderImplements
/:$readableName ClassHeaderImplements:/
+ClassHeaderPermittedSubclassesopt ::= $empty
+ClassHeaderPermittedSubclassesopt -> ClassHeaderPermittedSubclasses
+/:$readableName ClassHeaderPermittedSubclasses:/
+/:$compliance 15:/
+
+-- Production name hardcoded in parser. Must be ::= and not ->
+PermittedSubclasses ::= ClassTypeList
+/:$readableName PermittedSubclasses:/
+
+ClassHeaderPermittedSubclasses ::= RestrictedIdentifierpermits ClassTypeList
+/.$putCase consumeClassHeaderPermittedSubclasses(); $break ./
+/:$readableName ClassHeaderPermittedSubclasses:/
+/:$compliance 15:/
+
+InterfaceHeaderPermittedSubClassesAndSubInterfacesopt ::= $empty
+InterfaceHeaderPermittedSubClassesAndSubInterfacesopt -> InterfaceHeaderPermittedSubClassesAndSubInterfaces
+/:$readableName InterfaceHeaderPermittedSubClassesAndSubInterfaces:/
+/:$compliance 15:/
+
+InterfaceHeaderPermittedSubClassesAndSubInterfaces ::= RestrictedIdentifierpermits ClassTypeList
+/.$putCase consumeInterfaceHeaderPermittedSubClassesAndSubInterfaces(); $break ./
+/:$readableName InterfaceHeaderPermittedSubClassesAndSubInterfaces:/
+/:$compliance 15:/
+
InterfaceMemberDeclarationsopt ::= $empty
/. $putCase consumeEmptyInterfaceMemberDeclarationsopt(); $break ./
InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java
index 4950c1bfd1..8fe20ea15b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java
@@ -193,6 +193,26 @@ public final class Flags {
* @noreference This field is not intended to be referenced by clients as it is a part of Java preview feature.
*/
public static final int AccRecord = ExtraCompilerModifiers.AccRecord;
+ /**
+ * Sealed property flag.
+ * <p>
+ * Note that this flag's value is internal and is not defined in the
+ * Virtual Machine specification.
+ * </p>
+ * @since 3.23
+ * @noreference This field is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public static final int AccSealed = ExtraCompilerModifiers.AccSealed;
+ /**
+ * Non-sealed property flag.
+ * <p>
+ * Note that this flag's value is internal and is not defined in the
+ * Virtual Machine specification.
+ * </p>
+ * @since 3.23
+ * @noreference This field is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public static final int AccNonSealed = ExtraCompilerModifiers.AccNonSealed;
/**
* Not instantiable.
@@ -402,6 +422,30 @@ public final class Flags {
public static boolean isRecord(int flags) {
return (flags & AccRecord) != 0;
}
+ /**
+ * Returns whether the given integer has the <code>AccSealed</code>
+ * bit set.
+ *
+ * @param flags the flags
+ * @return <code>true</code> if the <code>AccSealed</code> flag is included
+ * @see #AccSealed
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public static boolean isSealed(int flags) {
+ return (flags & AccSealed) != 0;
+ }
+ /**
+ * Returns whether the given integer has the <code>AccNonSealed</code>
+ * bit set.
+ *
+ * @param flags the flags
+ * @return <code>true</code> if the <code>AccNonSealed</code> flag is included
+ * @see #AccNonSealed
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public static boolean isNonSealed(int flags) {
+ return (flags & AccNonSealed) != 0;
+ }
/**
* Returns whether the given integer has the <code>AccAnnotation</code>
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
index 0d16aaf890..3550361b88 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
@@ -759,6 +759,22 @@ public interface IType extends IMember, IAnnotatable {
String[] getSuperInterfaceNames() throws JavaModelException;
/**
+ * Returns the names of types that this sealed type permits to be its sub types.
+ * For a non sealed type, an empty array is returned.
+ * If type declares an explicit permits clause, then the permitted sub-types
+ * are returned in the declared order. If a sealed type does not explicitly
+ * declare permitted sub types, then the implicit permitted types, that is,
+ * the types in the same compilation unit that are sub types of this sealed type
+ * are returned in the order they appear within the compilation unit.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return names of types that this type permits to be its sub types
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ String[] getPermittedSubtypeNames() throws JavaModelException;
+
+ /**
* Returns the formal type parameter signatures for this type.
* Returns an empty array if this type has no formal type parameters.
* <p>
@@ -915,6 +931,16 @@ public interface IType extends IMember, IAnnotatable {
*/
boolean isRecord() throws JavaModelException;
/**
+ * Returns whether this type is a sealed type.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return true if this type this type is a sealed type, false otherwise
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ boolean isSealed() throws JavaModelException;
+
+ /**
* Returns the record components declared by this record class, or an empty
* array if this is not a record.
*
@@ -924,7 +950,7 @@ public interface IType extends IMember, IAnnotatable {
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
*/
default IField[] getRecordComponents() throws JavaModelException {
- return null;
+ return new IField[0];
}
/**
* Returns the record component with the specified name
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index b2a9d2b068..733c9b90a5 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -3120,12 +3120,18 @@ public final class JavaCore extends Plugin {
public static final String VERSION_14 = "14"; //$NON-NLS-1$
/**
* Configurable option value: {@value}.
+ * @since 3.23
+ * @category OptionValue
+ */
+ public static final String VERSION_15 = "15"; //$NON-NLS-1$
+ /**
+ * Configurable option value: {@value}.
* @since 3.4
* @category OptionValue
*/
public static final String VERSION_CLDC_1_1 = "cldc1.1"; //$NON-NLS-1$
private static List<String> allVersions = Collections.unmodifiableList(Arrays.asList(VERSION_CLDC_1_1, VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5,
- VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14));
+ VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15));
/**
* Returns all {@link JavaCore}{@code #VERSION_*} levels in the order of their
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
index c3f2ddabab..297f1f5364 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -207,6 +207,11 @@ public interface IAttributeNamesConstants {
* @since 3.22
*/
char[] RECORD = "Record".toCharArray(); //$NON-NLS-1$
+ /**
+ * "PermittedSubclasses" attribute (JVMS 15).
+ * @since 3.23
+ */
+ char[] PERMITTED_SUBCLASSES = "PermittedSubclasses".toCharArray(); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java
index f72dafb9ea..22b21f38b6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -137,6 +137,16 @@ public interface IClassFileReader {
}
/**
+ * Answer back the permitted subclasses attribute of this .class file, null if none.
+ *
+ * @return the permitted subclasses attribute of this .class file, null if none
+ * @since 3.23
+ */
+ default IPermittedSubclassesAttribute getPermittedSubclassesAttribute() {
+ return null;
+ }
+
+ /**
* Answer back the array of method infos of this .class file,
* an empty array if none.
*
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttribute.java
new file mode 100644
index 0000000000..467bb00f69
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttribute.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of permitted subclasses attribute as described in the JVM
+ * specifications.
+ *
+ * @since 3.23
+ */
+public interface IPermittedSubclassesAttribute extends IClassFileAttribute {
+
+ /**
+ * Answer back the number of permitted subclasses as specified in
+ * the JVM specifications.
+ *
+ * @return the number of permitted subclasses as specified in
+ * the JVM specifications
+ */
+ int getNumberOfPermittedSubclasses();
+
+ /**
+ * Answer back the array of permitted subclass attribute entries as specified in
+ * the JVM specifications, or an empty array if none.
+ *
+ * @return the array of permitted subclass attribute entries as specified in
+ * the JVM specifications, or an empty array if none
+ */
+ IPermittedSubclassesAttributeEntry[] getPermittedSubclassAttributesEntries();
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttributeEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttributeEntry.java
new file mode 100644
index 0000000000..3c3dc95677
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttributeEntry.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of permitted subclasses attribute as described in the JVM
+ * specifications.
+ *
+ * @since 3.23
+ */
+public interface IPermittedSubclassesAttributeEntry {
+
+ /**
+ * Answer back the permitted subclass name as specified
+ * in the JVM specifications.
+ *
+ * @return the permitted subclass name as specified
+ * in the JVM specifications
+ */
+ char[] getPermittedSubclassName();
+
+ /**
+ * Answer back the permitted subclass name index.
+ *
+ * @return the permitted class name index
+ */
+ int gePermittedSubclassIndex();
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
index 0ba46a2b3d..72d0758e13 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
@@ -17,12 +17,11 @@ import java.util.HashMap;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.Expression;
-import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
import org.eclipse.jdt.internal.compiler.ast.ModuleDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.RecordComponent;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
/*
@@ -89,6 +88,7 @@ public interface ISourceElementRequestor {
public int nameSourceEnd;
public char[] superclass;
public char[][] superinterfaces;
+ public char[][] permittedSubtypes;
public TypeParameterInfo[] typeParameters;
public char[][] categories;
public boolean secondary;
@@ -111,6 +111,7 @@ public interface ISourceElementRequestor {
public static class MethodInfo {
public boolean typeAnnotated;
+ public boolean isCanonicalConstr;
public boolean isConstructor;
public boolean isAnnotation;
public int declarationStart;
@@ -142,6 +143,7 @@ public interface ISourceElementRequestor {
public char[] name;
}
public static class FieldInfo {
+ public boolean isRecordComponent;
public boolean typeAnnotated;
public int declarationStart;
public int modifiers;
@@ -151,21 +153,9 @@ public interface ISourceElementRequestor {
public int nameSourceEnd;
public char[][] categories;
public Annotation[] annotations;
- public FieldDeclaration node;
+ public AbstractVariableDeclaration node;
}
- public static class RecordComponentInfo {
- public boolean typeAnnotated;
- public int declarationStart;
- public int modifiers;
- public char[] type;
- public char[] name;
- public int nameSourceStart;
- public int nameSourceEnd;
- public char[][] categories;
- public Annotation[] annotations;
- public RecordComponent node;
- }
void acceptAnnotationTypeReference(char[][] annotation, int sourceStart, int sourceEnd);
void acceptAnnotationTypeReference(char[] annotation, int sourcePosition);
@@ -229,8 +219,6 @@ public interface ISourceElementRequestor {
void enterMethod(MethodInfo methodInfo);
- void enterRecordComponent(RecordComponentInfo recordComponentInfo);
-
void enterType(TypeInfo typeInfo);
void exitCompilationUnit(int declarationEnd);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java
index b4a6370182..e530a64726 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java
@@ -44,7 +44,6 @@ import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.ModuleDeclaration;
import org.eclipse.jdt.internal.compiler.ast.OpensStatement;
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
-import org.eclipse.jdt.internal.compiler.ast.RecordComponent;
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
@@ -166,18 +165,23 @@ protected char[] getSuperclassName(TypeDeclaration typeDeclaration) {
TypeReference superclass = typeDeclaration.superclass;
return superclass != null ? CharOperation.concatWith(superclass.getParameterizedTypeName(), '.') : null;
}
+protected char[][] getPermittedSubTypes(TypeDeclaration typeDeclaration) {
+ return extractTypeReferences(typeDeclaration.permittedTypes);
+}
protected char[][] getThrownExceptions(AbstractMethodDeclaration methodDeclaration) {
- char[][] thrownExceptionTypes = null;
- TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
+ return extractTypeReferences(methodDeclaration.thrownExceptions);
+}
+private char[][] extractTypeReferences(TypeReference[] thrownExceptions) {
+ char[][] names = null;
if (thrownExceptions != null) {
int thrownExceptionLength = thrownExceptions.length;
- thrownExceptionTypes = new char[thrownExceptionLength][];
+ names = new char[thrownExceptionLength][];
for (int i = 0; i < thrownExceptionLength; i++) {
- thrownExceptionTypes[i] =
+ names[i] =
CharOperation.concatWith(thrownExceptions[i].getParameterizedTypeName(), '.');
}
}
- return thrownExceptionTypes;
+ return names;
}
protected char[][] getTypeParameterBounds(TypeParameter typeParameter) {
TypeReference firstBound = typeParameter.type;
@@ -307,6 +311,7 @@ protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDecl
currentModifiers |= ClassFileConstants.AccDeprecated;
methodInfo.isConstructor = true;
+ methodInfo.isCanonicalConstr = methodDeclaration.isCanonicalConstructor();
methodInfo.declarationStart = methodDeclaration.declarationSourceStart;
methodInfo.modifiers = currentModifiers;
methodInfo.name = methodDeclaration.selector;
@@ -536,8 +541,10 @@ protected void notifySourceElementRequestor(FieldDeclaration fieldDeclaration, T
fieldInfo.declarationStart = fieldDeclaration.declarationSourceStart;
fieldInfo.name = fieldDeclaration.name;
fieldInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag;
- if (fieldDeclaration.isARecordComponent)
+ if (fieldDeclaration.isARecordComponent) {
fieldInfo.modifiers |= ExtraCompilerModifiers.AccRecord;
+ fieldInfo.isRecordComponent = true;
+ }
fieldInfo.type = typeName;
fieldInfo.nameSourceStart = fieldDeclaration.sourceStart;
fieldInfo.nameSourceEnd = fieldDeclaration.sourceEnd;
@@ -621,40 +628,40 @@ protected void notifySourceElementRequestor(ModuleDeclaration moduleDeclaration)
this.requestor.exitModule(moduleDeclaration.declarationSourceEnd);
}
}
-protected void notifySourceElementRequestor(RecordComponent recordComponent, TypeDeclaration declaringType) {
- assert declaringType.isRecord();
-
- // range check
- boolean isInRange =
- this.initialPosition <= recordComponent.declarationSourceStart
- && this.eofPosition >= recordComponent.declarationSourceEnd;
- int recordComponentEndPosition = this.sourceEnds.get(recordComponent);
- if (recordComponentEndPosition == -1) {
- // use the declaration source end by default
- recordComponentEndPosition = recordComponent.declarationSourceEnd;
- }
- if (isInRange) {
- char[] typeName = CharOperation.concatWith(recordComponent.type.getParameterizedTypeName(), '.');
- ISourceElementRequestor.RecordComponentInfo recordComponentInfo = new ISourceElementRequestor.RecordComponentInfo();
- recordComponentInfo.typeAnnotated = ((recordComponent.bits & ASTNode.HasTypeAnnotations) != 0);
- recordComponentInfo.declarationStart = recordComponent.declarationSourceStart;
- recordComponentInfo.name = recordComponent.name;
- recordComponentInfo.type = typeName;
- recordComponentInfo.nameSourceStart = recordComponent.sourceStart;
- recordComponentInfo.nameSourceEnd = recordComponent.sourceEnd;
- recordComponentInfo.categories = this.nodesToCategories.get(recordComponent);
- recordComponentInfo.annotations = recordComponent.annotations;
- recordComponentInfo.node = recordComponent;
- this.requestor.enterRecordComponent(recordComponentInfo);
- }
- this.visitIfNeeded(recordComponent, declaringType);
- if (isInRange){
- this.requestor.exitRecordComponent(
- recordComponentEndPosition,
- recordComponent.declarationSourceEnd);
- }
-
-}
+//protected void notifySourceElementRequestor(RecordComponent recordComponent, TypeDeclaration declaringType) {
+// assert declaringType.isRecord();
+//
+// // range check
+// boolean isInRange =
+// this.initialPosition <= recordComponent.declarationSourceStart
+// && this.eofPosition >= recordComponent.declarationSourceEnd;
+// int recordComponentEndPosition = this.sourceEnds.get(recordComponent);
+// if (recordComponentEndPosition == -1) {
+// // use the declaration source end by default
+// recordComponentEndPosition = recordComponent.declarationSourceEnd;
+// }
+// if (isInRange) {
+// char[] typeName = CharOperation.concatWith(recordComponent.type.getParameterizedTypeName(), '.');
+// ISourceElementRequestor.RecordComponentInfo recordComponentInfo = new ISourceElementRequestor.RecordComponentInfo();
+// recordComponentInfo.typeAnnotated = ((recordComponent.bits & ASTNode.HasTypeAnnotations) != 0);
+// recordComponentInfo.declarationStart = recordComponent.declarationSourceStart;
+// recordComponentInfo.name = recordComponent.name;
+// recordComponentInfo.type = typeName;
+// recordComponentInfo.nameSourceStart = recordComponent.sourceStart;
+// recordComponentInfo.nameSourceEnd = recordComponent.sourceEnd;
+// recordComponentInfo.categories = this.nodesToCategories.get(recordComponent);
+// recordComponentInfo.annotations = recordComponent.annotations;
+// recordComponentInfo.node = recordComponent;
+// this.requestor.enterRecordComponent(recordComponentInfo);
+// }
+// this.visitIfNeeded(recordComponent, declaringType);
+// if (isInRange){
+// this.requestor.exitRecordComponent(
+// recordComponentEndPosition,
+// recordComponent.declarationSourceEnd);
+// }
+//
+//}
protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolean notifyTypePresence, TypeDeclaration declaringType, ImportReference currentPackage) {
if (CharOperation.equals(TypeConstants.PACKAGE_INFO_NAME, typeDeclaration.name)) return;
@@ -667,15 +674,12 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo
FieldDeclaration[] fields = typeDeclaration.fields;
AbstractMethodDeclaration[] methods = typeDeclaration.methods;
TypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
- RecordComponent[] recordComponents = typeDeclaration.recordComponents;
int fieldCounter = fields == null ? 0 : fields.length;
int methodCounter = methods == null ? 0 : methods.length;
int memberTypeCounter = memberTypes == null ? 0 : memberTypes.length;
- int recordComponentCounter = recordComponents == null ? 0 : recordComponents.length;
int fieldIndex = 0;
int methodIndex = 0;
int memberTypeIndex = 0;
- int recordComponentIndex = 0;
if (notifyTypePresence){
char[][] interfaceNames = getInterfaceNames(typeDeclaration);
@@ -704,7 +708,10 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo
} else {
typeInfo.declarationStart = typeDeclaration.allocation.sourceStart;
}
- typeInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag;
+ typeInfo.modifiers = deprecated
+ ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated
+ : currentModifiers & ExtraCompilerModifiers.AccJustFlag;
+ typeInfo.modifiers |= currentModifiers & (ExtraCompilerModifiers.AccSealed | ExtraCompilerModifiers.AccNonSealed);
typeInfo.name = typeDeclaration.name;
typeInfo.nameSourceStart = isEnumInit ? typeDeclaration.allocation.enumConstant.sourceStart : typeDeclaration.sourceStart;
typeInfo.nameSourceEnd = sourceEnd(typeDeclaration);
@@ -717,6 +724,9 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo
typeInfo.annotations = typeDeclaration.annotations;
typeInfo.extraFlags = ExtraFlags.getExtraFlags(typeDeclaration);
typeInfo.node = typeDeclaration;
+ if ((currentModifiers & ExtraCompilerModifiers.AccSealed) != 0) {
+ typeInfo.permittedSubtypes = getPermittedSubTypes(typeDeclaration);
+ }
switch (kind) {
case TypeDeclaration.CLASS_DECL :
if (superclassName != null)
@@ -748,12 +758,10 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo
}
while ((fieldIndex < fieldCounter)
|| (memberTypeIndex < memberTypeCounter)
- || (methodIndex < methodCounter)
- || (recordComponentIndex < recordComponentCounter)) {
+ || (methodIndex < methodCounter)) {
FieldDeclaration nextFieldDeclaration = null;
AbstractMethodDeclaration nextMethodDeclaration = null;
TypeDeclaration nextMemberDeclaration = null;
- RecordComponent nextRecordComponent = null;
int position = Integer.MAX_VALUE;
int nextDeclarationType = -1;
@@ -778,18 +786,9 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo
nextDeclarationType = 2; // MEMBER
}
}
- if (recordComponentIndex < recordComponentCounter) {
- nextRecordComponent = recordComponents[recordComponentIndex];
- if (nextRecordComponent.declarationSourceStart < position) {
- position = nextRecordComponent.declarationSourceStart;
- nextDeclarationType = 3; // RECORD_COMPONENT
- }
- }
switch (nextDeclarationType) {
case 0 :
fieldIndex++;
-// if (typeDeclaration.isRecord() && nextFieldDeclaration.isARecordComponent)
-// break;
notifySourceElementRequestor(nextFieldDeclaration, typeDeclaration);
break;
case 1 :
@@ -800,10 +799,6 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo
memberTypeIndex++;
notifySourceElementRequestor(nextMemberDeclaration, true, null, currentPackage);
break;
- case 3 :
- recordComponentIndex++;
- notifySourceElementRequestor(nextRecordComponent, typeDeclaration);
- break;
}
}
if (notifyTypePresence){
@@ -957,19 +952,6 @@ private void visitIfNeeded(FieldDeclaration field, TypeDeclaration declaringType
}
}
}
-private void visitIfNeeded(RecordComponent component, TypeDeclaration declaringType) {
- if (this.localDeclarationVisitor != null
- && (component.bits & ASTNode.HasLocalType) != 0) {
- if (component.initialization != null) {
- try {
- this.localDeclarationVisitor.pushDeclaringType(declaringType);
- component.initialization.traverse(this.localDeclarationVisitor, (MethodScope) null);
- } finally {
- this.localDeclarationVisitor.popDeclaringType();
- }
- }
- }
-}
private void visitIfNeeded(Initializer initializer) {
if (this.localDeclarationVisitor != null
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java
index 17ec28efde..54449400ef 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,7 +13,9 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
@@ -114,6 +116,11 @@ private void acceptJavadocTypeReference(Expression expression) {
} else if (expression instanceof JavadocQualifiedTypeReference) {
JavadocQualifiedTypeReference qualifiedRef = (JavadocQualifiedTypeReference) expression;
this.requestor.acceptTypeReference(qualifiedRef.tokens, qualifiedRef.sourceStart, qualifiedRef.sourceEnd);
+ } else if (expression instanceof JavadocModuleReference) {
+ Expression exp = ((JavadocModuleReference) expression).getTypeReference();
+ if (exp != null) {
+ acceptJavadocTypeReference(exp);
+ }
}
}
public void addUnknownRef(NameReference nameRef) {
@@ -1032,6 +1039,73 @@ protected QualifiedNameReference newQualifiedNameReference(char[][] tokens, long
protected SingleNameReference newSingleNameReference(char[] source, long positions) {
return new SingleNameReference(source, positions);
}
+private class DummyTypeReference extends TypeReference {
+ char[] token;
+ DummyTypeReference(char[] name) {
+ this.token = name;
+ }
+ @Override
+ public TypeReference augmentTypeWithAdditionalDimensions(int additionalDimensions,
+ Annotation[][] additionalAnnotations, boolean isVarargs) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ public char[] getLastToken() {
+ return this.token;
+ }
+ @Override
+ protected TypeBinding getTypeBinding(Scope scope) {
+ return null;
+ }
+ @Override
+ public char[][] getTypeName() {
+ return new char[][] {this.token};
+ }
+ @Override
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ return output.append(this.token);
+ }
+ @Override
+ public String toString() {
+ return new String(this.token);
+ }
+}
+private void processImplicitPermittedTypes(TypeDeclaration typeDecl, TypeDeclaration[] allTypes) {
+ if (typeDecl.permittedTypes == null &&
+ (typeDecl.modifiers & ExtraCompilerModifiers.AccSealed) != 0) {
+ List<TypeReference> list = new ArrayList();
+ for (TypeDeclaration type : allTypes) {
+ if (type != typeDecl) {
+ char[][] qName = type.superclass == null ? null : type.superclass.getTypeName();
+ if (qName != null &&
+ CharOperation.equals(qName[qName.length -1], typeDecl.name)) {
+ list.add(new DummyTypeReference(type.name));
+ }
+ if (type.superInterfaces != null) {
+ for (TypeReference ref : type.superInterfaces) {
+ qName = ref.getTypeName();
+ if (CharOperation.equals(qName[qName.length -1], typeDecl.name)) {
+ list.add(new DummyTypeReference(type.name));
+ break;
+ }
+ }
+ }
+ }
+ }
+ typeDecl.permittedTypes = list.toArray(new TypeReference[list.size()]);
+ }
+}
public CompilationUnitDeclaration parseCompilationUnit(
ICompilationUnit unit,
boolean fullParse,
@@ -1046,6 +1120,12 @@ public CompilationUnitDeclaration parseCompilationUnit(
this.reportReferenceInfo = fullParse;
CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.options.maxProblemsPerUnit);
parsedUnit = parse(unit, compilationUnitResult);
+ TypeDeclaration[] types = parsedUnit.types;
+ if (types != null) {
+ for (TypeDeclaration typeDecl : types) {
+ processImplicitPermittedTypes(typeDecl, types);
+ }
+ }
if (pm != null && pm.isCanceled())
throw new OperationCanceledException(Messages.operation_cancelled);
if (this.scanner.recordLineSeparator) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java
index 8b17f04707..05d54686fe 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java
@@ -180,10 +180,6 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
}
@Override
- public void enterRecordComponent(RecordComponentInfo recordComponentInfo) {
- // default implementation: do nothing
- }
- @Override
public void enterType(TypeInfo typeInfo) {
// default implementation: do nothing
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
index 29b31b1349..33967f8407 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
@@ -570,6 +570,14 @@ public class SourceTypeConverter extends TypeConverter {
type.superInterfaces[i].bits |= ASTNode.IsSuperType;
}
}
+ char[][] permittedSubtypeNames = typeInfo.getPermittedSubtypeNames();
+ int permittedSubtypeCount = permittedSubtypeNames == null ? 0 : permittedSubtypeNames.length;
+ if (permittedSubtypeCount > 0) {
+ type.permittedTypes = new TypeReference[permittedSubtypeCount];
+ for (int i = 0; i < permittedSubtypeCount; i++) {
+ type.permittedTypes[i] = createTypeReference(permittedSubtypeNames[i], start, end, true /* include generics */);
+ }
+ }
/* convert member types */
if ((this.flags & MEMBER_TYPE) != 0) {
SourceType[] sourceMemberTypes = typeInfo.getMemberTypeHandles();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryRecordComponent.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryRecordComponent.java
new file mode 100644
index 0000000000..678dfe0931
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryRecordComponent.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
+import org.eclipse.jdt.internal.compiler.env.IBinaryField;
+import org.eclipse.jdt.internal.compiler.lookup.Binding;
+
+/**
+ * @see IField
+ */
+
+/* package */ class BinaryRecordComponent extends BinaryMember implements IField {
+
+/*
+ * Constructs a handle to the field with the given name in the specified type.
+ */
+protected BinaryRecordComponent(JavaElement parent, String name) {
+ super(parent, name);
+}
+@Override
+public boolean equals(Object o) {
+ if (!(o instanceof BinaryRecordComponent)) return false;
+ return super.equals(o);
+}
+@Override
+public IAnnotation[] getAnnotations() throws JavaModelException {
+ IBinaryField info = (IBinaryField) getElementInfo();
+ IBinaryAnnotation[] binaryAnnotations = info.getAnnotations();
+ return getAnnotations(binaryAnnotations, info.getTagBits());
+}
+/*
+ * @see IField
+ */
+@Override
+public Object getConstant() throws JavaModelException {
+ IBinaryField info = (IBinaryField) getElementInfo();
+ return convertConstant(info.getConstant());
+}
+/*
+ * @see IMember
+ */
+@Override
+public int getFlags() throws JavaModelException {
+ IBinaryField info = (IBinaryField) getElementInfo();
+ return info.getModifiers();
+}
+/*
+ * @see IJavaElement
+ */
+@Override
+public int getElementType() {
+ return FIELD;
+}
+/*
+ * @see JavaElement#getHandleMemento()
+ */
+@Override
+protected char getHandleMementoDelimiter() {
+ return JavaElement.JEM_FIELD;
+}
+@Override
+public String getKey(boolean forceOpen) throws JavaModelException {
+ return getKey(this, forceOpen);
+}
+/*
+ * @see IField
+ */
+@Override
+public String getTypeSignature() throws JavaModelException {
+ IBinaryField info = (IBinaryField) getElementInfo();
+ char[] genericSignature = info.getGenericSignature();
+ if (genericSignature != null) {
+ return new String(ClassFile.translatedName(genericSignature));
+ }
+ return new String(ClassFile.translatedName(info.getTypeName()));
+}
+/* (non-Javadoc)
+ * @see org.eclipse.jdt.core.IField#isEnumConstant()
+ */@Override
+public boolean isEnumConstant() throws JavaModelException {
+ return Flags.isEnum(getFlags());
+}
+
+@Override
+public boolean isResolved() {
+ return false;
+}
+@Override
+public JavaElement resolved(Binding binding) {
+ SourceRefElement resolvedHandle = new ResolvedBinaryField(this.parent, this.name, new String(binding.computeUniqueKey()));
+ resolvedHandle.occurrenceCount = this.occurrenceCount;
+ return resolvedHandle;
+}
+/*
+ * @private Debugging purposes
+ */
+@Override
+protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) {
+ buffer.append(tabString(tab));
+ if (info == null) {
+ toStringName(buffer);
+ buffer.append(" (not open)"); //$NON-NLS-1$
+ } else if (info == NO_INFO) {
+ toStringName(buffer);
+ } else {
+ try {
+ buffer.append(Signature.toString(getTypeSignature()));
+ buffer.append(" "); //$NON-NLS-1$
+ toStringName(buffer);
+ } catch (JavaModelException e) {
+ buffer.append("<JavaModelException in toString of " + getElementName()); //$NON-NLS-1$
+ }
+ }
+}
+@Override
+public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException {
+ JavadocContents javadocContents = ((BinaryType) this.getDeclaringType()).getJavadocContents(monitor);
+ if (javadocContents == null) return null;
+ return javadocContents.getFieldDoc(this);
+}
+@Override
+public boolean isRecordComponent() throws JavaModelException {
+ return false;
+}
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
index 95f7640af8..f7ccbe0f40 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
@@ -589,6 +589,21 @@ public String[] getSuperInterfaceNames() throws JavaModelException {
}
return strings;
}
+@Override
+public String[] getPermittedSubtypeNames() throws JavaModelException {
+ IBinaryType info = (IBinaryType) getElementInfo();
+ char[][] names= info.getPermittedSubtypeNames();
+ int length;
+ if (names == null || (length = names.length) == 0) {
+ return CharOperation.NO_STRINGS;
+ }
+ names= ClassFile.translatedNames(names);
+ String[] strings= new String[length];
+ for (int i= 0; i < length; i++) {
+ strings[i]= new String(names[i]);
+ }
+ return strings;
+}
/**
* @see IType#getSuperInterfaceTypeSignatures()
@@ -743,6 +758,16 @@ public boolean isRecord() throws JavaModelException {
IBinaryType info = (IBinaryType) getElementInfo();
return TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.RECORD_DECL;
}
+/**
+ * @see IType#isSealed()
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+@Override
+public boolean isSealed() throws JavaModelException {
+ IBinaryType info = (IBinaryType) getElementInfo();
+ char[][] names = info.getPermittedSubtypeNames();
+ return (names != null && names.length > 0);
+}
@Override
public boolean isInterface() throws JavaModelException {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
index d7f86001a5..47a5ba2426 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
@@ -18,12 +18,14 @@ import java.util.HashMap;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
import org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair;
import org.eclipse.jdt.internal.compiler.env.IBinaryField;
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
@@ -235,6 +237,10 @@ private void generateFieldInfos(IType type, IBinaryType typeInfo, HashMap newEle
JavaModelManager manager = JavaModelManager.getJavaModelManager();
for (int i = 0, fieldCount = fields.length; i < fieldCount; i++) {
IBinaryField fieldInfo = fields[i];
+ // If the type is a record and this is an instance field, it can only be a record component
+ // Filter out
+ if (typeInfo.isRecord() && (fieldInfo.getModifiers() & ClassFileConstants.AccStatic) == 0)
+ continue;
BinaryField field = new BinaryField((JavaElement)type, manager.intern(new String(fieldInfo.getName())));
newElements.put(field, fieldInfo);
childrenHandles.add(field);
@@ -242,6 +248,30 @@ private void generateFieldInfos(IType type, IBinaryType typeInfo, HashMap newEle
}
}
/**
+ * Creates the handles and infos for the fields of the given binary type.
+ * Adds new handles to the given vector.
+ */
+private void generateRecordComponentInfos(IType type, IBinaryType typeInfo, HashMap newElements, ArrayList childrenHandles) {
+ // Make the fields
+ IRecordComponent[] components = typeInfo.getRecordComponents();
+ if (components == null) {
+ return;
+ }
+ JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ for (int i = 0, fieldCount = components.length; i < fieldCount; i++) {
+ IRecordComponent componentInfo = components[i];
+ BinaryField component = new BinaryField((JavaElement)type, manager.intern(new String(componentInfo.getName()))) {
+ @Override
+ public boolean isRecordComponent() throws JavaModelException {
+ return true;
+ }
+ };
+ newElements.put(component, componentInfo);
+ childrenHandles.add(component);
+ generateAnnotationsInfos(component, componentInfo.getAnnotations(), componentInfo.getTagBits(), newElements);
+ }
+}
+/**
* Creates the handles for the inner types of the given binary type.
* Adds new handles to the given vector.
*/
@@ -428,6 +458,7 @@ protected void readBinaryChildren(ClassFile classFile, HashMap newElements, IBin
generateAnnotationsInfos(type, typeInfo.getAnnotations(), typeInfo.getTagBits(), newElements);
generateTypeParameterInfos(type, typeInfo.getGenericSignature(), newElements, typeParameterHandles);
generateFieldInfos(type, typeInfo, newElements, childrenHandles);
+ generateRecordComponentInfos(type, typeInfo, newElements, childrenHandles);
generateMethodInfos(type, typeInfo, newElements, childrenHandles, typeParameterHandles);
generateInnerClassHandles(type, typeInfo, childrenHandles); // Note inner class are separate openables that are not opened here: no need to pass in newElements
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
index 4ae54d9987..79dc7be0e3 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
@@ -239,7 +239,7 @@ protected SourceField createField(JavaElement parent, FieldInfo fieldInfo) {
String fieldName = JavaModelManager.getJavaModelManager().intern(new String(fieldInfo.name));
return new SourceField(parent, fieldName);
}
-protected SourceField createRecordComponent(JavaElement parent, RecordComponentInfo compInfo) {
+protected SourceField createRecordComponent(JavaElement parent, FieldInfo compInfo) {
String name = JavaModelManager.getJavaModelManager().intern(new String(compInfo.name));
SourceField field = new SourceField(parent, name) {
@Override
@@ -355,7 +355,11 @@ public void enterField(FieldInfo fieldInfo) {
JavaElement parentHandle= (JavaElement) this.handleStack.peek();
SourceField handle = null;
if (parentHandle.getElementType() == IJavaElement.TYPE) {
- handle = createField(parentHandle, fieldInfo);
+ if (fieldInfo.isRecordComponent) {
+ handle = createRecordComponent(parentHandle, fieldInfo);
+ } else {
+ handle = createField(parentHandle, fieldInfo);
+ }
}
else {
Assert.isTrue(false); // Should not happen
@@ -436,6 +440,7 @@ private SourceMethodElementInfo createMethodInfo(MethodInfo methodInfo, SourceMe
} else {
info = elements.length == 0 ? new SourceMethodInfo() : new SourceMethodWithChildrenInfo(elements);
}
+ info.isCanonicalConstructor = methodInfo.isCanonicalConstr;
info.setSourceRangeStart(methodInfo.declarationStart);
int flags = methodInfo.modifiers;
info.setNameSourceStart(methodInfo.nameSourceStart);
@@ -584,10 +589,14 @@ private SourceTypeElementInfo createTypeInfo(TypeInfo typeInfo, SourceType handl
JavaModelManager manager = JavaModelManager.getJavaModelManager();
char[] superclass = typeInfo.superclass;
info.setSuperclassName(superclass == null ? null : manager.intern(superclass));
- char[][] superinterfaces = typeInfo.superinterfaces;
- for (int i = 0, length = superinterfaces == null ? 0 : superinterfaces.length; i < length; i++)
- superinterfaces[i] = manager.intern(superinterfaces[i]);
- info.setSuperInterfaceNames(superinterfaces);
+ char[][] typeNames = typeInfo.superinterfaces;
+ for (int i = 0, length = typeNames == null ? 0 : typeNames.length; i < length; i++)
+ typeNames[i] = manager.intern(typeNames[i]);
+ info.setSuperInterfaceNames(typeNames);
+ typeNames = typeInfo.permittedSubtypes;
+ for (int i = 0, length = typeNames == null ? 0 : typeNames.length; i < length; i++)
+ typeNames[i] = manager.intern(typeNames[i]);
+ info.setPermittedSubtypeNames(typeNames);
info.addCategories(handle, typeInfo.categories);
this.newElements.put(handle, info);
@@ -727,7 +736,7 @@ public void exitField(int initializationStart, int declarationEnd, int declarati
@Override
public void exitRecordComponent(int declarationEnd, int declarationSourceEnd) {
JavaElement handle = (JavaElement) this.handleStack.peek();
- RecordComponentInfo compInfo = (RecordComponentInfo) this.infoStack.peek();
+ FieldInfo compInfo = (FieldInfo) this.infoStack.peek();
IJavaElement[] elements = getChildren(compInfo);
SourceFieldElementInfo info = elements.length == 0 ? new SourceFieldElementInfo() : new SourceFieldWithChildrenInfo(elements);
info.isRecordComponent = true;
@@ -944,23 +953,4 @@ protected Object getMemberValue(org.eclipse.jdt.internal.core.MemberValuePair me
return null;
}
}
-@Override
-public void enterRecordComponent(RecordComponentInfo recordComponentInfo) {
- TypeInfo parentInfo = (TypeInfo) this.infoStack.peek();
- JavaElement parentHandle= (JavaElement) this.handleStack.peek();
- SourceField handle = null;
- if (parentHandle.getElementType() == IJavaElement.TYPE) {
- handle = createRecordComponent(parentHandle, recordComponentInfo);
- }
- else {
- Assert.isTrue(false); // Should not happen
- }
- resolveDuplicates(handle);
-
- addToChildren(parentInfo, handle);
- parentInfo.childrenCategories.put(handle, recordComponentInfo.categories);
-
- this.infoStack.push(recordComponentInfo);
- this.handleStack.push(handle);
-}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
index 5cea5b616f..2583c18bfd 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
@@ -90,7 +90,7 @@ public class CopyResourceElementsOperation extends MultiOperation implements Suf
initializeASTParser();
}
private void initializeASTParser() {
- this.parser = ASTParser.newParser(AST.JLS14);
+ this.parser = ASTParser.newParser(getLatestASTLevel());
}
/**
* Returns the children of <code>source</code> which are affected by this operation.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java
index d1635908a7..d4d092cb1b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -267,7 +267,7 @@ public abstract class CreateElementInCUOperation extends JavaModelOperation {
// ensure cu is consistent (noop if already consistent)
cu.makeConsistent(this.progressMonitor);
// create an AST for the compilation unit
- ASTParser parser = ASTParser.newParser(AST.JLS14);
+ ASTParser parser = ASTParser.newParser(getLatestASTLevel());
parser.setSource(cu);
return (CompilationUnit) parser.createAST(this.progressMonitor);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
index 65a1e92ae5..99bd3977d0 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
@@ -23,7 +23,6 @@ import org.eclipse.jdt.core.IJavaModelStatusConstants;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
@@ -86,7 +85,7 @@ protected StructuralPropertyDescriptor getChildPropertyDescriptor(ASTNode parent
protected ASTNode generateElementAST(ASTRewrite rewriter, ICompilationUnit cu) throws JavaModelException {
if (this.createdNode == null) {
this.source = removeIndentAndNewLines(this.source, cu);
- ASTParser parser = ASTParser.newParser(AST.JLS14);
+ ASTParser parser = ASTParser.newParser(getLatestASTLevel());
parser.setSource(this.source.toCharArray());
parser.setProject(getCompilationUnit().getJavaProject());
parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
@@ -173,7 +172,7 @@ protected String generateSyntaxIncorrectAST() {
buff.append(lineSeparator + " public class A {" + lineSeparator); //$NON-NLS-1$
buff.append(this.source);
buff.append(lineSeparator).append('}');
- ASTParser parser = ASTParser.newParser(AST.JLS14);
+ ASTParser parser = ASTParser.newParser(getLatestASTLevel());
parser.setSource(buff.toString().toCharArray());
CompilationUnit compilationUnit = (CompilationUnit) parser.createAST(null);
TypeDeclaration typeDeclaration = (TypeDeclaration) compilationUnit.types().iterator().next();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
index c119a55d24..380132d662 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -84,7 +84,7 @@ public class DeleteElementsOperation extends MultiOperation {
}
private void initASTParser() {
- this.parser = ASTParser.newParser(AST.JLS14);
+ this.parser = ASTParser.newParser(getLatestASTLevel());
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
index 0b53db6ed4..3b664d4b3b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
@@ -446,7 +446,7 @@ public abstract class JavaElement extends PlatformObject implements IJavaElement
for (int i = children.length-1; i >= 0; i--) {
IJavaElement aChild = children[i];
if (aChild instanceof SourceRefElement) {
- SourceRefElement child = (SourceRefElement) children[i];
+ SourceRefElement child = (SourceRefElement) aChild;
ISourceRange range = child.getSourceRange();
int start = range.getOffset();
int end = start + range.getLength();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java
index 2fee564093..8dd3ad41d9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -22,6 +22,7 @@ import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jdt.core.*;
+import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.internal.core.util.Messages;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -153,6 +154,9 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, IProgres
this.elementsToProcess = new IJavaElement[]{element};
}
+ protected int getLatestASTLevel() {
+ return AST.JLS15;
+ }
/*
* Registers the given action at the end of the list of actions to run.
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
index 8ee095c0ca..51f82007f0 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
@@ -14,6 +14,7 @@
package org.eclipse.jdt.internal.core;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -271,6 +272,14 @@ public void acceptField(char[] declaringTypePackageName, char[] declaringTypeNam
if(type != null) {
try {
IField[] fields = type.getFields();
+ if (type.isRecord()) {
+ IField[] comps = type.getRecordComponents();
+ if(comps.length > 0) {
+ IField[] f = fields;
+ fields = Arrays.copyOf(f, f.length + comps.length);
+ System.arraycopy(comps, 0, fields, f.length, comps.length);
+ }
+ }
for (int i = 0; i < fields.length; i++) {
IField field = fields[i];
ISourceRange range = field.getNameRange();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
index 44a3a65505..fc595f9a8f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
@@ -915,24 +915,6 @@ public class SourceMapper
addCategories(field, fieldInfo.categories);
}
}
- /**
- * @see ISourceElementRequestor
- */
- @Override
- public void enterRecordComponent(RecordComponentInfo compInfo) {
- if (this.typeDepth >= 0) {
- this.memberDeclarationStart[this.typeDepth] = compInfo.declarationStart;
- this.memberNameRange[this.typeDepth] =
- new SourceRange(compInfo.nameSourceStart, compInfo.nameSourceEnd - compInfo.nameSourceStart + 1);
- String fieldName = new String(compInfo.name);
- this.memberName[this.typeDepth] = fieldName;
-
- // categories
- IType currentType = this.types[this.typeDepth];
- IField field = currentType.getRecordComponent(fieldName);
- addCategories(field, compInfo.categories);
- }
- }
/**
* @see ISourceElementRequestor
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
index 3d31be1c69..f99005feb4 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
@@ -49,6 +49,8 @@ public abstract class SourceMethodElementInfo extends AnnotatableInfo implements
*/
protected ITypeParameter[] typeParameters = TypeParameter.NO_TYPE_PARAMETERS;
+ protected boolean isCanonicalConstructor;
+
@Override
public char[][] getArgumentNames() {
return this.argumentNames;
@@ -86,6 +88,9 @@ public char[][] getTypeParameterNames() {
}
@Override
public abstract boolean isConstructor();
+public boolean isCanonicalConstructor() {
+ return this.isCanonicalConstructor;
+}
public abstract boolean isAnnotationMethod();
protected void setArgumentNames(char[][] names) {
this.argumentNames = names;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java
index 504a131128..a2bbf9c9c2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java
@@ -300,6 +300,12 @@ public IField[] getRecordComponents() throws JavaModelException {
return NO_FIELDS;
return getFieldsOrComponents(true);
}
+@Override
+public String[] getPermittedSubtypeNames() throws JavaModelException {
+ SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
+ char[][] names= info.getPermittedSubtypeNames();
+ return CharOperation.toStrings(names);
+}
private IField[] getFieldsOrComponents(boolean component) throws JavaModelException {
ArrayList list = getChildrenOfType(FIELD);
if (list.size() == 0) {
@@ -694,6 +700,15 @@ public boolean isRecord() throws JavaModelException {
SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
return TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.RECORD_DECL;
}
+/**
+ * @see IType#isSealed()
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+@Override
+public boolean isSealed() throws JavaModelException {
+ SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
+ return Flags.isSealed(info.getModifiers());
+}
/**
* @see IType
@@ -967,6 +982,9 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean s
}
} else {
try {
+ if (isSealed()) {
+ buffer.append("sealed "); //$NON-NLS-1$
+ }
if (isRecord()) {
buffer.append("record "); //$NON-NLS-1$
} else if (isEnum()) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java
index de6bb33d80..69934eabce 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -50,6 +50,8 @@ public class SourceTypeElementInfo extends AnnotatableInfo implements ISourceTyp
*/
protected char[][] superInterfaceNames;
+ protected char[][] permittedTypeNames;
+
/**
* Backpointer to my type handle - useful for translation
* from info to handle.
@@ -182,7 +184,16 @@ public char[][] getInterfaceNames() {
}
return this.superInterfaceNames;
}
-
+/**
+ * @see ISourceType
+ */
+@Override
+public char[][] getPermittedSubtypeNames() {
+ if (isAnonymous()) { // if anonymous type
+ return null;
+ }
+ return this.permittedTypeNames;
+}
/**
* @see ISourceType
*/
@@ -334,6 +345,9 @@ protected void setSuperclassName(char[] superclassName) {
protected void setSuperInterfaceNames(char[][] superInterfaceNames) {
this.superInterfaceNames = superInterfaceNames;
}
+protected void setPermittedSubtypeNames(char[][] permittedTypeNames) {
+ this.permittedTypeNames = permittedTypeNames;
+}
@Override
public String toString() {
return "Info for " + this.handle.toString(); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
index 58adc80954..e1f16f002b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
@@ -57,7 +57,7 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
protected Path releasePath;
protected Path modulePath;
private String modPathString;
- private CtSym ctSym;
+ CtSym ctSym;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
index a92f2fc9ed..ff0aef001d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -27,6 +27,7 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus;
@@ -233,6 +234,10 @@ public boolean isLocal() {
return false; // index did not record this information (since unused for hierarchies)
}
@Override
+public boolean isRecord() {
+ return false; // index did not record this information (since unused for hierarchies)
+}
+@Override
public boolean isMember() {
return false; // index did not record this information (since unused for hierarchies)
}
@@ -337,4 +342,9 @@ public char[] getModule() {
public ExternalAnnotationStatus getExternalAnnotationStatus() {
return ExternalAnnotationStatus.NOT_EEA_CONFIGURED;
}
+
+@Override
+public IRecordComponent[] getRecordComponents() {
+ return null;
+}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
index be4e2edac1..5568fc98f0 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
@@ -209,11 +209,6 @@ protected SourceElementParser getParser(Map<String, String> settings) {
}
@Override
-public void enterRecordComponent(RecordComponentInfo recordComponentInfo) {
- // TODO Auto-generated method stub
-}
-
-@Override
public void exitRecordComponent(int declarationEnd, int declarationSourceEnd) {
// TODO Auto-generated method stub
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
index 3203fceddd..1e4092af0e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
@@ -30,6 +30,7 @@ import org.eclipse.jdt.core.util.IInnerClassesAttribute;
import org.eclipse.jdt.core.util.IMethodInfo;
import org.eclipse.jdt.core.util.IModifierConstants;
import org.eclipse.jdt.core.util.INestMembersAttribute;
+import org.eclipse.jdt.core.util.IPermittedSubclassesAttribute;
import org.eclipse.jdt.core.util.IRecordAttribute;
import org.eclipse.jdt.core.util.ISourceAttribute;
import org.eclipse.jdt.internal.compiler.util.Util;
@@ -49,6 +50,7 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
private int fieldsCount;
private IInnerClassesAttribute innerClassesAttribute;
private INestMembersAttribute nestMembersAttribute;
+ private IPermittedSubclassesAttribute permittedSubclassesAttribute;
private int[] interfaceIndexes;
private char[][] interfaceNames;
private int interfacesCount;
@@ -314,6 +316,9 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
} else if (equals(attributeName, IAttributeNamesConstants.RECORD)) {
this.recordAttribute = new RecordAttribute(classFileBytes, this.constantPool, readOffset);
this.attributes[attributesIndex++] = this.recordAttribute;
+ } else if (equals(attributeName, IAttributeNamesConstants.PERMITTED_SUBCLASSES)) {
+ this.permittedSubclassesAttribute = new PermittedSubclassesAttribute(classFileBytes, this.constantPool, readOffset);
+ this.attributes[attributesIndex++] = this.permittedSubclassesAttribute;
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
}
@@ -395,6 +400,9 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
public IFieldInfo[] getFieldInfos() {
return this.fields;
}
+ /*
+ * @see IClassFileReader#getFieldInfos()
+ */
/**
* @see IClassFileReader#getFieldsCount()
@@ -417,6 +425,11 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
return this.nestMembersAttribute;
}
+ @Override
+ public IPermittedSubclassesAttribute getPermittedSubclassesAttribute() {
+ return this.permittedSubclassesAttribute;
+ }
+
/**
* @see IClassFileReader#getInterfaceIndexes()
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
index 8bb273a84e..2899853fd6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
@@ -1023,6 +1023,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
INestMembersAttribute nestMembersAttribute = classFileReader.getNestMembersAttribute();
+ IPermittedSubclassesAttribute permittedSubclassesAttribute = classFileReader.getPermittedSubclassesAttribute();
IInnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute();
IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
@@ -1184,6 +1185,9 @@ public class Disassembler extends ClassFileBytesDisassembler {
if (nestMembersAttribute != null) {
remainingAttributesLength--;
}
+ if (permittedSubclassesAttribute != null) {
+ remainingAttributesLength--;
+ }
if (innerClassesAttribute != null
|| enclosingMethodAttribute != null
|| nestHostAttribute != null
@@ -1191,6 +1195,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
|| bootstrapMethods != null
|| moduleAttribute != null
|| recordAttribute != null
+ || permittedSubclassesAttribute != null
|| remainingAttributesLength != 0) {
// this test is to ensure we don't insert more than one line separator
if (buffer.lastIndexOf(lineSeparator) != buffer.length() - lineSeparator.length()) {
@@ -1215,6 +1220,9 @@ public class Disassembler extends ClassFileBytesDisassembler {
if (bootstrapMethods != null) {
disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
}
+ if (permittedSubclassesAttribute != null) {
+ disassemble(permittedSubclassesAttribute, buffer, lineSeparator, 0);
+ }
if (checkMode(mode, SYSTEM)) {
if (runtimeVisibleAnnotationsAttribute != null) {
disassemble((IRuntimeVisibleAnnotationsAttribute) runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
@@ -1235,6 +1243,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
&& attribute != nestHostAttribute
&& attribute != nestMembersAttribute
&& attribute != recordAttribute
+ && attribute != permittedSubclassesAttribute
&& attribute != sourceAttribute
&& attribute != signatureAttribute
&& attribute != enclosingMethodAttribute
@@ -1478,6 +1487,32 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
}
}
+ private void disassemble(IPermittedSubclassesAttribute permittedSubclassesAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
+ writeNewLine(buffer, lineSeparator, tabNumber);
+ writeNewLine(buffer, lineSeparator, tabNumber); // additional line
+ buffer.append(Messages.disassembler_permittedsubclasses);
+ writeNewLine(buffer, lineSeparator, tabNumber + 1);
+ IPermittedSubclassesAttributeEntry[] entries = permittedSubclassesAttribute.getPermittedSubclassAttributesEntries();
+ int length = entries.length;
+ int permittedSubclassesIndex;
+ IPermittedSubclassesAttributeEntry entry;
+ for (int i = 0; i < length; i++) {
+ if (i != 0) {
+ buffer.append(Messages.disassembler_comma);
+ writeNewLine(buffer, lineSeparator, tabNumber + 1);
+ }
+ entry = entries[i];
+ permittedSubclassesIndex = entry.gePermittedSubclassIndex();
+ buffer
+ .append(Messages.disassembler_constantpoolindex)
+ .append(permittedSubclassesIndex);
+ if (permittedSubclassesIndex != 0) {
+ buffer
+ .append(Messages.disassembler_space)
+ .append(entry.getPermittedSubclassName());
+ }
+ }
+ }
private void disassemble(IPackageVisibilityInfo iPackageVisibilityInfo, StringBuffer buffer, String lineSeparator,
int tabNumber, boolean isExports) {
buffer.append(isExports ? "exports" : "opens"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java
index 989b64b8b4..91cbd74f6f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java
@@ -282,6 +282,7 @@ public final class Messages extends NLS {
public static String disassembler_nesthost;
public static String disassembler_nestmembers;
public static String disassembler_record;
+ public static String disassembler_permittedsubclasses;
public static String disassembler_components;
public static String disassembler_endofcomponent;
public static String disassembler_genericattributeheader;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttribute.java
new file mode 100644
index 0000000000..7b19f861cd
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttribute.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IPermittedSubclassesAttributeEntry;
+import org.eclipse.jdt.core.util.IPermittedSubclassesAttribute;
+
+/**
+ * Default implementation of IPermittedSubclassesAttribute.
+ */
+public class PermittedSubclassesAttribute extends ClassFileAttribute implements IPermittedSubclassesAttribute {
+ private static final IPermittedSubclassesAttributeEntry[] NO_ENTRIES = new IPermittedSubclassesAttributeEntry[0];
+
+ private int permittedSubclasses;
+ private IPermittedSubclassesAttributeEntry[] entries;
+
+ /**
+ * Constructor for PermittedSubclassesAttribute.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public PermittedSubclassesAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ this.permittedSubclasses = u2At(classFileBytes, 6, offset);
+ final int length = this.permittedSubclasses;
+ if (length != 0) {
+ int readOffset = 8;
+ this.entries = new IPermittedSubclassesAttributeEntry[length];
+ for (int i = 0; i < length; i++) {
+ this.entries[i] = new PermittedSubclassesAttributeEntry(classFileBytes, constantPool, offset + readOffset);
+ readOffset += 2;
+ }
+ } else {
+ this.entries = NO_ENTRIES;
+ }
+ }
+
+ @Override
+ public int getNumberOfPermittedSubclasses() {
+ return this.permittedSubclasses;
+ }
+
+ @Override
+ public IPermittedSubclassesAttributeEntry[] getPermittedSubclassAttributesEntries() {
+ return this.entries;
+ }
+
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttributeEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttributeEntry.java
new file mode 100644
index 0000000000..bb33b4b2ae
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttributeEntry.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+import org.eclipse.jdt.core.util.IPermittedSubclassesAttributeEntry;
+
+public class PermittedSubclassesAttributeEntry extends ClassFileStruct implements IPermittedSubclassesAttributeEntry {
+
+ private int permittedClassNameIndex;
+ private char[] permittedClassName;
+
+ public PermittedSubclassesAttributeEntry(byte[] classFileBytes, IConstantPool constantPool, int offset)
+ throws ClassFormatException {
+ this.permittedClassNameIndex = u2At(classFileBytes, 0, offset);
+ if (this.permittedClassNameIndex != 0) {
+ IConstantPoolEntry constantPoolEntry;
+ constantPoolEntry = constantPool.decodeEntry(this.permittedClassNameIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.permittedClassName = constantPoolEntry.getClassInfoName();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return new String(this.permittedClassName);
+ }
+
+ @Override
+ public char[] getPermittedSubclassName() {
+ return this.permittedClassName;
+ }
+
+ @Override
+ public int gePermittedSubclassIndex() {
+ return this.permittedClassNameIndex;
+ }
+}
+
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
index d7d6bc39c0..f2b81783c4 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
@@ -4263,6 +4263,7 @@ public static boolean isKeyword(int token) {
case TerminalTokens.TokenNameinstanceof:
case TerminalTokens.TokenNamelong:
case TerminalTokens.TokenNamenew:
+ case TerminalTokens.TokenNamenon_sealed:
case TerminalTokens.TokenNamenull:
case TerminalTokens.TokenNamenative:
case TerminalTokens.TokenNamepublic:
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties
index cb269da38b..cd39d61412 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2018 IBM Corporation and others.
+# Copyright (c) 2000, 2020 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -302,6 +302,7 @@ disassembler_arraydimensions = []
disassembler_nesthost = Nest Host:
disassembler_nestmembers = Nest Members:
disassembler_record = Record:
+disassembler_permittedsubclasses = PermittedSubclasses:
disassembler_components = Components:
disassembler_endofcomponent = ;
disassembler_innerattributesheader = Inner classes:
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index cb333c75c9..52b5ceaaae 100644
--- a/org.eclipse.jdt.core/pom.xml
+++ b/org.eclipse.jdt.core/pom.xml
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
- <version>3.23.0-SNAPSHOT</version>
+ <version>3.23.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/org.eclipse.jdt.core/scripts/GenerateParserScript.java b/org.eclipse.jdt.core/scripts/GenerateParserScript.java
index 56cb92a033..8089bf894a 100644
--- a/org.eclipse.jdt.core/scripts/GenerateParserScript.java
+++ b/org.eclipse.jdt.core/scripts/GenerateParserScript.java
@@ -82,6 +82,7 @@ public class GenerateParserScript {
javasymText = javasymText.replace(",\n ", ",\n\t\t\t\t\t\t\t");
javasymText = javasymText.replace("TokenName$eof", "TokenNameEOF");
javasymText = javasymText.replace("TokenName$error", "TokenNameERROR");
+ javasymText = javasymText.replace("TokenNamenon-sealed", "TokenNamenon_sealed");
Files.write(terminalTokensFile.toPath(), (terminalTokensProlog + "\tint " + javasymText).getBytes());
}
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java
index b52465ffb7..81412140de 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -492,6 +492,18 @@ public interface IJavaSearchConstants {
*/
int METHOD_REFERENCE_EXPRESSION = 0x10000000;
+ /**
+ * Return only type references used as a permit type (Java 15)
+ * <p>
+ * When this flag is set, only {@link TypeReferenceMatch} matches will be
+ * returned.
+ *</p>
+ * @since 3.23
+ * @noreference permit type reference
+ * @category limitTo
+ */
+ int PERMITTYPE_TYPE_REFERENCE = 0x20000000;
+
/* Syntactic match modes */
/**
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java
index 7063275d5d..db59626672 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java
@@ -1932,6 +1932,9 @@ public static SearchPattern createPattern(IJavaElement element, int limitTo) {
* <tr>
* <td>{@link IJavaSearchConstants#METHOD_REFERENCE_EXPRESSION METHOD_REFERENCE_EXPRESSION}
* <td>Return only method reference expressions (e.g. <code>A :: foo</code>).
+ * <tr>
+ * <td>{@link IJavaSearchConstants#PERMITTYPE_TYPE_REFERENCE PERMITTYPE_TYPE_REFERENCE}
+ * <td>Return only type references used as a permit type.
* </table>
* </li>
* </ul>
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java
index a46a254b57..1cc09eafcc 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/IndexBinaryType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2017 Google, Inc and others.
+ * Copyright (c) 2016, 2020 Google, Inc and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -29,6 +29,7 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
+import org.eclipse.jdt.internal.compiler.env.IRecordComponent;
import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker;
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus;
@@ -351,6 +352,10 @@ public class IndexBinaryType implements IBinaryType {
return this.isLocal;
}
+ @Override
+ public boolean isRecord() {
+ return false;
+ }
@Override
public boolean isMember() {
@@ -673,4 +678,10 @@ public class IndexBinaryType implements IBinaryType {
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public IRecordComponent[] getRecordComponents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java
index 049d944fe4..5f382aa5e1 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java
@@ -292,14 +292,6 @@ public void enterField(FieldInfo fieldInfo) {
this.methodDepth++;
}
/**
- * @see ISourceElementRequestor#enterRecordComponent(ISourceElementRequestor.RecordComponentInfo)
- */
-@Override
-public void enterRecordComponent(RecordComponentInfo componentInfo) {
- this.indexer.addFieldDeclaration(componentInfo.type, componentInfo.name);
- this.methodDepth++;
-}
-/**
* @see ISourceElementRequestor#enterInitializer(int, int)
*/
@Override
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java
index ba86508209..d3b8ea525f 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -163,6 +163,9 @@ public class JavaSearchPattern extends SearchPattern implements IIndexConstants
case IJavaSearchConstants.METHOD_REFERENCE_EXPRESSION:
buffer.append("METHOD_REFERENCE_EXPRESSION"); //$NON-NLS-1$
break;
+ case IJavaSearchConstants.PERMITTYPE_TYPE_REFERENCE:
+ buffer.append("PERMITTYPE_TYPE_REFERENCE"); //$NON-NLS-1$
+ break;
}
}
return buffer.toString();
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
index 0d85df5022..8c436b4a2f 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -3183,7 +3183,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc
} else {
TypeReference superClass = type.superclass;
if (superClass != null) {
- reportMatchingSuper(superClass, enclosingElement, type.binding, nodeSet, matchedClassContainer);
+ reportMatchingSuperOrPermit(superClass, enclosingElement, type.binding, nodeSet, matchedClassContainer);
for (int i = 0, length = superClass.annotations == null ? 0 : superClass.annotations.length; i < length; i++) {
Annotation[] annotations = superClass.annotations[i];
if (annotations == null) continue;
@@ -3193,7 +3193,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc
TypeReference[] superInterfaces = type.superInterfaces;
if (superInterfaces != null) {
for (int i = 0, l = superInterfaces.length; i < l; i++) {
- reportMatchingSuper(superInterfaces[i], enclosingElement, type.binding, nodeSet, matchedClassContainer);
+ reportMatchingSuperOrPermit(superInterfaces[i], enclosingElement, type.binding, nodeSet, matchedClassContainer);
TypeReference typeReference = type.superInterfaces[i];
Annotation[][] annotations = typeReference != null ? typeReference.annotations : null;
if (annotations != null) {
@@ -3204,6 +3204,21 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc
}
}
}
+ TypeReference[] permittedTypes = type.permittedTypes;
+ if (permittedTypes != null) {
+ for (int i = 0, l = permittedTypes.length; i < l; i++) {
+ reportMatchingSuperOrPermit(permittedTypes[i], enclosingElement, type.binding, nodeSet, matchedClassContainer);
+ TypeReference typeReference = type.permittedTypes[i];
+ Annotation[][] annotations = typeReference != null ? typeReference.annotations : null;
+ if (annotations != null) {
+ for (int j = 0, length = annotations.length; j < length; j++) {
+ if (annotations[j] == null) continue;
+ reportMatching(annotations[j], enclosingElement, null, type.binding, nodeSet, matchedClassContainer, enclosesElement);
+ }
+ }
+ }
+ }
+
}
// filter out element not in hierarchy scope
@@ -3377,7 +3392,7 @@ protected void reportMatching(TypeParameter[] typeParameters, IJavaElement enclo
}
}
}
-protected void reportMatchingSuper(TypeReference superReference, IJavaElement enclosingElement, Binding elementBinding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException {
+protected void reportMatchingSuperOrPermit(TypeReference superReference, IJavaElement enclosingElement, Binding elementBinding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException {
ASTNode[] nodes = null;
if (superReference instanceof ParameterizedSingleTypeReference || superReference instanceof ParameterizedQualifiedTypeReference) {
long lastTypeArgumentInfo = findLastTypeArgumentInfo(superReference);
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
index a0ee17160d..1429f13edc 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -154,6 +154,12 @@ public void checkComment() {
if (references != null) {
for (int i=0, length=references.length; i < length; i++) {
Expression reference = references[i];
+ if (reference instanceof JavadocModuleReference) {
+ JavadocModuleReference modRef = (JavadocModuleReference)reference;
+ if (modRef.typeReference != null) {
+ this.patternLocator.match(modRef.typeReference, this.nodeSet);
+ }
+ }
if (reference instanceof TypeReference) {
TypeReference typeRef = (TypeReference) reference;
this.patternLocator.match(typeRef, this.nodeSet);
@@ -164,6 +170,12 @@ public void checkComment() {
TypeReference typeRef = (TypeReference) fieldRef.receiver;
this.patternLocator.match(typeRef, this.nodeSet);
}
+ if (fieldRef.receiver instanceof JavadocModuleReference) {
+ JavadocModuleReference modRef = (JavadocModuleReference)fieldRef.receiver;
+ if (modRef.typeReference != null) {
+ this.patternLocator.match(modRef.typeReference, this.nodeSet);
+ }
+ }
} else if (reference instanceof JavadocMessageSend) {
JavadocMessageSend messageSend = (JavadocMessageSend) reference;
this.patternLocator.match(messageSend, this.nodeSet);
@@ -904,6 +916,27 @@ protected void consumeWildcardBoundsSuper() {
}
@Override
+protected void consumeInterfaceHeaderPermittedSubClassesAndSubInterfaces(){
+ super.consumeInterfaceHeaderPermittedSubClassesAndSubInterfaces();
+ updatePatternLocaterMatch();
+}
+private void updatePatternLocaterMatch() {
+ if ((this.patternFineGrain & IJavaSearchConstants.PERMITTYPE_TYPE_REFERENCE) != 0) {
+ TypeDeclaration td = (TypeDeclaration) this.astStack[this.astPtr];
+ TypeReference[] permittedTypes = td.permittedTypes;
+ for (TypeReference pt : permittedTypes) {
+ this.patternLocator.match(pt, this.nodeSet);
+ }
+ }
+}
+
+@Override
+protected void consumeClassHeaderPermittedSubclasses() {
+ super.consumeClassHeaderPermittedSubclasses();
+ updatePatternLocaterMatch();
+}
+
+@Override
protected TypeReference augmentTypeWithAdditionalDimensions(TypeReference typeRef, int additionalDimensions, Annotation [][] additionalAnnotations, boolean isVarargs) {
TypeReference result = super.augmentTypeWithAdditionalDimensions(typeRef, additionalDimensions, additionalAnnotations, isVarargs);
if (this.nodeSet.removePossibleMatch(typeRef) != null)
diff --git a/org.eclipse.jdt.tests.latestBREE/.classpath b/org.eclipse.jdt.tests.latestBREE/.classpath
index fbb3530a20..a0ffe6ed8d 100644
--- a/org.eclipse.jdt.tests.latestBREE/.classpath
+++ b/org.eclipse.jdt.tests.latestBREE/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15">
<attributes>
<attribute name="module" value="true"/>
</attributes>
diff --git a/org.eclipse.jdt.tests.latestBREE/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.tests.latestBREE/.settings/org.eclipse.jdt.core.prefs
index 3beffdde2e..7e69c71939 100644
--- a/org.eclipse.jdt.tests.latestBREE/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jdt.tests.latestBREE/.settings/org.eclipse.jdt.core.prefs
@@ -10,9 +10,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=14
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=14
+org.eclipse.jdt.core.compiler.compliance=15
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -27,7 +27,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=enabled
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
@@ -112,4 +112,4 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=14
+org.eclipse.jdt.core.compiler.source=15
diff --git a/org.eclipse.jdt.tests.latestBREE/META-INF/MANIFEST.MF b/org.eclipse.jdt.tests.latestBREE/META-INF/MANIFEST.MF
index f4ddbe760b..993c7a0394 100644
--- a/org.eclipse.jdt.tests.latestBREE/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.tests.latestBREE/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@ Require-Bundle: org.junit;bundle-version="3.8.1",
org.eclipse.jdt.core.tests.model;bundle-version="[3.10.0,4.0.0)",
org.eclipse.jdt.core.tests.compiler;bundle-version="[3.10.0,4.0.0)",
javax.annotation
-Bundle-RequiredExecutionEnvironment: JavaSE-14
+Bundle-RequiredExecutionEnvironment: JavaSE-15
Automatic-Module-Name: org.eclipse.jdt.tests.latestBREE
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.jdt.core.tests.compiler.regression.latest,
diff --git a/org.eclipse.jdt.tests.latestBREE/pom.xml b/org.eclipse.jdt.tests.latestBREE/pom.xml
index 097d87157c..7f3bc0230e 100644
--- a/org.eclipse.jdt.tests.latestBREE/pom.xml
+++ b/org.eclipse.jdt.tests.latestBREE/pom.xml
@@ -103,6 +103,36 @@
<tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,13,14</tycho.surefire.argLine>
</properties>
</profile>
+ <profile>
+ <id>test-on-javase-15</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-toolchains-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>toolchain</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <toolchains>
+ <jdk>
+ <id>JavaSE-15</id>
+ </jdk>
+ </toolchains>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,13,14,15</tycho.surefire.argLine>
+ </properties>
+ </profile>
</profiles>
</project>
diff --git a/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/compiler/regression/latest/TextBlockTest.java b/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/compiler/regression/latest/TextBlockTest.java
index 0838c1fe55..c7560b3466 100644
--- a/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/compiler/regression/latest/TextBlockTest.java
+++ b/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/compiler/regression/latest/TextBlockTest.java
@@ -20,7 +20,6 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import junit.framework.Test;
-@SuppressWarnings("preview")
public class TextBlockTest extends AbstractRegressionTest {
static {
diff --git a/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/model/CompletionTests13.java b/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/model/CompletionTests13.java
index 82237b0ffe..00a8830857 100644
--- a/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/model/CompletionTests13.java
+++ b/org.eclipse.jdt.tests.latestBREE/src/org/eclipse/jdt/core/tests/model/CompletionTests13.java
@@ -18,7 +18,6 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import junit.framework.Test;
-@SuppressWarnings("preview")
public class CompletionTests13 extends AbstractJavaModelCompletionTests {
static {

Back to the top