Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjay2018-09-26 07:06:28 +0000
committerjay2018-09-26 07:06:28 +0000
commit3ccd57c481cc77b3726464874886fdf9669c7a5c (patch)
tree8dfdfbd7e0bd3568fc04f02ff7fb2627706d883f /org.eclipse.jdt.core
parent2a269a8600046558a3c0af2e8dcd9a733817dfd9 (diff)
parent1aa58eac3b0985df8c3358b7c4aec62fb9a6b2e8 (diff)
downloadeclipse.jdt.core-3ccd57c481cc77b3726464874886fdf9669c7a5c.tar.gz
eclipse.jdt.core-3ccd57c481cc77b3726464874886fdf9669c7a5c.tar.xz
eclipse.jdt.core-3ccd57c481cc77b3726464874886fdf9669c7a5c.zip
Merge branch 'BETA_JAVA11'
# Conflicts: # org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchFilerImpl.java # org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java # org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolTests.java # org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.java # org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractNullAnnotationTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JEP286ReservedWordTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JEP286Test.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodParametersAttributeTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PolymorphicSignatureTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java # org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava10Tests.java # org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter10Test.java # org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests10.java # org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs10Tests.java # org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java # org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java # org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java # org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java # org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java # org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java # org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java # org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java # org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java # org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java Change-Id: If63162fb2d7e2e3a57e078289a4b6cf31c31ab66
Diffstat (limited to 'org.eclipse.jdt.core')
-rw-r--r--org.eclipse.jdt.core/.settings/.api_filters11
-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/ClasspathJep247.java12
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java93
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties1
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java8
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java68
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java43
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java15
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java32
-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/ConstantPool.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java89
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java17
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java44
-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/ScannerHelper.java158
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties1
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java38
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java15
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java1
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java46
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java15
-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/IConstantPool.java6
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java18
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestHostAttribute.java34
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMemberAttributeEntry.java35
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMembersAttribute.java38
-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.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java28
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java21
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java23
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java15
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java27
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java96
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java49
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java64
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java52
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties4
-rw-r--r--org.eclipse.jdt.core/pom.xml2
70 files changed, 1105 insertions, 271 deletions
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
new file mode 100644
index 0000000000..e67e798741
--- /dev/null
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.jdt.core" version="2">
+ <resource path="model/org/eclipse/jdt/core/util/IClassFileReader.java" type="org.eclipse.jdt.core.util.IClassFileReader">
+ <filter comment="default method added for getting nest members" id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.util.IClassFileReader"/>
+ <message_argument value="getNestMembersAttribute()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index 372143941b..1246d4debe 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.15.0.qualifier
+Bundle-Version: 3.15.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/ClasspathJep247.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java
index 42647fd90c..7a39271115 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.jdt.internal.compiler.batch;
import java.io.File;
@@ -96,7 +106,7 @@ public class ClasspathJep247 extends ClasspathJrt {
if (this.compliance == null) {
return;
}
- this.releaseInHex = Integer.toHexString(Integer.parseInt(this.compliance));
+ this.releaseInHex = Integer.toHexString(Integer.parseInt(this.compliance)).toUpperCase();
Path filePath = this.jdkHome.toPath().resolve("lib").resolve("ct.sym"); //$NON-NLS-1$ //$NON-NLS-2$
URI t = filePath.toUri();
if (!Files.exists(filePath)) {
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 fef902c3b3..0c08f07347 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
@@ -1384,6 +1384,7 @@ public class Main implements ProblemSeverities, SuffixConstants {
// == Main.NONE: absorbent element, do not output class files;
// else: use as the path of the directory into which class files must
// be written.
+ protected boolean enablePreview;
protected String releaseVersion;
private boolean didSpecifySource;
private boolean didSpecifyTarget;
@@ -1702,7 +1703,11 @@ public String bind(String id, String[] arguments) {
* <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_4</code></li>
* <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_5</code></li>
* <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_6</code></li>
- * <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_7</code></li>
+ * <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_8</code></li>
+ * <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK9</code></li>
+ * <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK10</code></li>
+ * <li><code>org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK11</code></li>
+ *
* </ul>
* @param minimalSupportedVersion the given minimal version
* @return true if and only if the running VM supports the given minimal version, false otherwise
@@ -1726,30 +1731,7 @@ private boolean checkVMVersion(long minimalSupportedVersion) {
// by default we don't support a class file version we cannot recognize
return false;
}
- switch(majorVersion) {
- case ClassFileConstants.MAJOR_VERSION_1_1 : // 1.0 and 1.1
- return ClassFileConstants.JDK1_1 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_2 : // 1.2
- return ClassFileConstants.JDK1_2 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_3 : // 1.3
- return ClassFileConstants.JDK1_3 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_4 : // 1.4
- return ClassFileConstants.JDK1_4 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_5 : // 1.5
- return ClassFileConstants.JDK1_5 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_6 : // 1.6
- return ClassFileConstants.JDK1_6 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_7 : // 1.7
- return ClassFileConstants.JDK1_7 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_1_8: // 1.8
- return ClassFileConstants.JDK1_8 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_9: // 9
- return ClassFileConstants.JDK9 >= minimalSupportedVersion;
- case ClassFileConstants.MAJOR_VERSION_10: // 9
- return ClassFileConstants.JDK10 >= minimalSupportedVersion;
- }
- // unknown version
- return false;
+ return ClassFileConstants.getComplianceLevelForJavaVersion(majorVersion) >=minimalSupportedVersion;
}
/*
* Low-level API performing the actual compilation
@@ -2182,6 +2164,16 @@ public void configure(String[] argv) {
mode = DEFAULT;
continue;
}
+ if (currentArg.equals("-11") || currentArg.equals("-11.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_11);
+ mode = DEFAULT;
+ continue;
+ }
if (currentArg.equals("-d")) { //$NON-NLS-1$
if (this.destinationPath != null) {
StringBuffer errorMessage = new StringBuffer();
@@ -2215,6 +2207,11 @@ public void configure(String[] argv) {
mode = INSIDE_BOOTCLASSPATH_start;
continue;
}
+ if (currentArg.equals("--enable-preview")) { //$NON-NLS-1$
+ this.enablePreview = true;
+ mode = DEFAULT;
+ continue;
+ }
if (currentArg.equals("--system")) { //$NON-NLS-1$
mode = INSIDE_SYSTEM;
continue;
@@ -2722,6 +2719,8 @@ public void configure(String[] argv) {
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9);
} else if (currentArg.equals("10") || currentArg.equals("10.0")) { //$NON-NLS-1$//$NON-NLS-2$
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_10);
+ } else if (currentArg.equals("11") || currentArg.equals("11.0")) { //$NON-NLS-1$//$NON-NLS-2$
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_11);
}
else if (currentArg.equals("jsr14")) { //$NON-NLS-1$
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_JSR14);
@@ -2768,7 +2767,7 @@ public void configure(String[] argv) {
// If release >= 9, the following are disallowed
// --system and --upgrade-module-path
- // -source and -target are diasllowed for any --release
+ // -source and -target are disallowed for any --release
this.releaseVersion = currentArg;
long releaseToJDKLevel = CompilerOptions.releaseToJDKLevel(currentArg);
if (releaseToJDKLevel == 0) {
@@ -2809,6 +2808,8 @@ public void configure(String[] argv) {
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_9);
} else if (currentArg.equals("10") || currentArg.equals("10.0")) { //$NON-NLS-1$//$NON-NLS-2$
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_10);
+ } else if (currentArg.equals("11") || currentArg.equals("11.0")) { //$NON-NLS-1$//$NON-NLS-2$
+ this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_11);
} else {
throw new IllegalArgumentException(this.bind("configure.source", currentArg)); //$NON-NLS-1$
}
@@ -3075,6 +3076,11 @@ public void configure(String[] argv) {
mode = DEFAULT;
continue;
}
+ if (this.enablePreview) {
+ this.options.put(
+ CompilerOptions.OPTION_EnablePreviews,
+ CompilerOptions.ENABLED);
+ }
// set DocCommentSupport, with appropriate side effects on defaults if
// javadoc is not enabled
@@ -5391,10 +5397,31 @@ protected void validateOptions(boolean didSpecifyCompliance) {
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_10);
if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_10);
}
+ } else {
+ if (!this.didSpecifyTarget) {
+ if (this.didSpecifySource) {
+ String source = this.options.get(CompilerOptions.OPTION_Source);
+ if (CompilerOptions.VERSION_1_3.equals(source)
+ || CompilerOptions.VERSION_1_4.equals(source)) {
+ if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
+ } else if (CompilerOptions.VERSION_1_5.equals(source)
+ || CompilerOptions.VERSION_1_6.equals(source)) {
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
+ } else {
+ if (CompilerOptions.versionToJdkLevel(source) > 0)
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, source);
+ }
+ } else {
+ if (CompilerOptions.versionToJdkLevel(version) > 0) {
+ this.options.put(CompilerOptions.OPTION_Source, version);
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, version);
+ }
+ }
+ }
}
} else if (this.didSpecifySource) {
- Object version = this.options.get(CompilerOptions.OPTION_Source);
+ String version = this.options.get(CompilerOptions.OPTION_Source);
// default is source 1.3 target 1.2 and compliance 1.4
if (CompilerOptions.VERSION_1_4.equals(version)) {
if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
@@ -5417,6 +5444,11 @@ protected void validateOptions(boolean didSpecifyCompliance) {
} else if (CompilerOptions.VERSION_10.equals(version)) {
if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_10);
if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_10);
+ } else {
+ if (CompilerOptions.versionToJdkLevel(version) > 0) {
+ if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, version);
+ if (!this.didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, version);
+ }
}
}
@@ -5453,6 +5485,13 @@ protected void validateOptions(boolean didSpecifyCompliance) {
&& this.complianceLevel < ClassFileConstants.JDK1_4) {
// compliance must be 1.4 if source is 1.4
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
+ } else {
+ long ver = CompilerOptions.versionToJdkLevel(sourceVersion);
+ if(this.complianceLevel < ver)
+ throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", this.options.get(CompilerOptions.OPTION_Compliance), sourceVersion)); //$NON-NLS-1$
+ }
+ if (this.enablePreview && this.complianceLevel != ClassFileConstants.getLatestJDKLevel()) {
+ throw new IllegalArgumentException(this.bind("configure.unsupportedPreview")); //$NON-NLS-1$
}
// check and set compliance/source/target compatibilities
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 7d288563a6..c02926b66d 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
@@ -91,6 +91,7 @@ configure.incompatibleComplianceForTarget = Compliance level ''{0}'' is incompat
configure.repetition = repetition must be a positive integer: {0}
configure.maxProblems = max problems must be a positive integer: {0}
configure.invalidNowarnOption = invalid syntax for nowarn option: {0}
+configure.unsupportedPreview = Preview of features is supported only at the latest source level
configure.invalidErrorConfiguration = invalid error configuration: ''{0}''
configure.invalidError = invalid error token: ''{0}''. Ignoring this error token and compiling
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
index deaee44d86..5976850032 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -57,6 +57,7 @@ import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
@@ -1477,6 +1478,13 @@ public final class SelectionEngine extends Engine implements ISearchRequestor {
return true;
}
@Override
+ public boolean visit(
+ Argument argument, BlockScope scope) {
+ if (argument.type instanceof SingleTypeReference && ((SingleTypeReference)argument.type).token == assistIdentifier)
+ throw new SelectionNodeFound(argument.binding.type);
+ return true; // do nothing by default, keep traversing
+ }
+ @Override
public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) {
if (typeDeclaration.name == assistIdentifier) {
throw new SelectionNodeFound(typeDeclaration.binding);
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 fe2394e740..0aa6f16a4b 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
@@ -4882,6 +4882,9 @@ public NameReference createSingleAssistNameReference(char[] assistName, long pos
keywords[count++]= Keywords.VAR;
}
} else if(kind != K_BETWEEN_CASE_AND_COLON && kind != K_BETWEEN_DEFAULT_AND_COLON) {
+ if (kind == K_LOCAL_INITIALIZER_DELIMITER && this.options.complianceLevel >= ClassFileConstants.JDK11) {
+ keywords[count++]= Keywords.VAR;
+ }
keywords[count++]= Keywords.TRUE;
keywords[count++]= Keywords.FALSE;
keywords[count++]= Keywords.NULL;
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 3e6375ce83..265a7218b2 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
@@ -2074,5 +2074,7 @@ void setSourceStart(int sourceStart);
int VarIsReservedInFuture = Syntax + 1510; // ''var'' should not be used as an type name, since it is a reserved word from source level 10 on
/** @since 3.14 */
int VarIsNotAllowedHere = Syntax + 1511; // ''var'' is not allowed here
+ /** @since 3.15 BETA_JAVA11*/
+ int VarCannotBeMixedWithNonVarParams = Syntax + 1512; // ''var'' cannot be mixed with explicit or implicit parameters
}
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 d6eb5419e5..3641ca2fad 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
@@ -174,6 +174,7 @@ public class ClassFile implements TypeConstants, TypeIds {
public static final int INITIAL_CONTENTS_SIZE = 400;
public static final int INITIAL_HEADER_SIZE = 1500;
public static final int INNER_CLASSES_SIZE = 5;
+ public static final int NESTED_MEMBER_SIZE = 5;
/**
* INTERNAL USE-ONLY
@@ -449,6 +450,10 @@ public class ClassFile implements TypeConstants, TypeIds {
attributesNumber += generateTypeAnnotationAttributeForTypeDeclaration();
+ if (this.targetJDK >= ClassFileConstants.JDK11) {
+ // add nestMember and nestHost attributes
+ attributesNumber += generateNestAttributes();
+ }
// update the number of attributes
if (attributeOffset + 2 >= this.contents.length) {
resizeContents(2);
@@ -2657,6 +2662,69 @@ public class ClassFile implements TypeConstants, TypeIds {
this.contentsOffset = localContentsOffset;
return 1;
}
+ private int generateNestHostAttribute() {
+ SourceTypeBinding nestHost = this.referenceBinding.getNestHost();
+ if (nestHost == null)
+ return 0;
+ int localContentsOffset = this.contentsOffset;
+ if (localContentsOffset + 10 >= this.contents.length) {
+ resizeContents(10);
+ }
+ int nestHostAttributeNameIndex =
+ this.constantPool.literalIndex(AttributeNamesConstants.NestHost);
+ this.contents[localContentsOffset++] = (byte) (nestHostAttributeNameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nestHostAttributeNameIndex;
+
+ // The value of the attribute_length item must be two.
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = 2;
+
+ int nestHostIndex = this.constantPool.literalIndexForType(nestHost.constantPoolName());
+ this.contents[localContentsOffset++] = (byte) (nestHostIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nestHostIndex;
+ this.contentsOffset = localContentsOffset;
+ return 1;
+ }
+ private int generateNestMembersAttribute() {
+
+ int localContentsOffset = this.contentsOffset;
+ List<String> nestedMembers = this.referenceBinding.getNestMembers();
+ int numberOfNestedMembers = nestedMembers != null ? nestedMembers.size() : 0;
+ if (numberOfNestedMembers == 0) // JVMS 11 4.7.29 says "at most one" NestMembers attribute - return if none.
+ return 0;
+
+ int exSize = 8 + 2 * numberOfNestedMembers;
+ if (exSize + localContentsOffset >= this.contents.length) {
+ resizeContents(exSize);
+ }
+ int attributeNameIndex =
+ this.constantPool.literalIndex(AttributeNamesConstants.NestMembers);
+ this.contents[localContentsOffset++] = (byte) (attributeNameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) attributeNameIndex;
+ int value = (numberOfNestedMembers << 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) (numberOfNestedMembers >> 8);
+ this.contents[localContentsOffset++] = (byte) numberOfNestedMembers;
+
+ for (int i = 0; i < numberOfNestedMembers; i++) {
+ char[] nestMemberName = nestedMembers.get(i).toCharArray();
+ int nestedMemberIndex = this.constantPool.literalIndexForType(nestMemberName);
+ this.contents[localContentsOffset++] = (byte) (nestedMemberIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nestedMemberIndex;
+ }
+ this.contentsOffset = localContentsOffset;
+ return 1;
+ }
+ private int generateNestAttributes() {
+ int nAttrs = generateNestMembersAttribute(); //either member or host will exist 4.7.29
+ nAttrs += generateNestHostAttribute();
+ return nAttrs;
+ }
private int generateModuleAttribute(ModuleDeclaration module) {
ModuleBinding binding = module.binding;
int localContentsOffset = this.contentsOffset;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index 5c3c0c347c..6e2fb89be3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
@@ -297,7 +297,9 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
MethodBinding codegenBinding = this.binding.original();
ReferenceBinding declaringClass;
- if (codegenBinding.isPrivate() && TypeBinding.notEquals(currentScope.enclosingSourceType(), (declaringClass = codegenBinding.declaringClass))) {
+ if (codegenBinding.isPrivate() &&
+ !currentScope.enclosingSourceType().isNestmateOf(this.binding.declaringClass) &&
+ TypeBinding.notEquals(currentScope.enclosingSourceType(), (declaringClass = codegenBinding.declaringClass))) {
// from 1.4 on, local type constructor can lose their private flag to ease emulation
if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
index 68fde662ed..0553640750 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -253,7 +253,9 @@ public class ExplicitConstructorCall extends Statement implements Invocation {
MethodBinding codegenBinding = this.binding.original();
// perform some emulation work in case there is some and we are inside a local type only
- if (this.binding.isPrivate() && this.accessMode != ExplicitConstructorCall.This) {
+ if (this.binding.isPrivate() &&
+ !currentScope.enclosingSourceType().isNestmateOf(this.binding.declaringClass) &&
+ this.accessMode != ExplicitConstructorCall.This) {
ReferenceBinding declaringClass = codegenBinding.declaringClass;
// from 1.4 on, local type constructor can lose their private flag to ease emulation
if ((declaringClass.tagBits & TagBits.IsLocalType) != 0 && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
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 e560fdbaa2..51f10252c3 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
@@ -548,7 +548,8 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
// if field from parameterized type got found, use the original field at codegen time
FieldBinding codegenBinding = this.binding.original();
if (this.binding.isPrivate()) {
- if ((TypeBinding.notEquals(currentScope.enclosingSourceType(), codegenBinding.declaringClass))
+ if (!currentScope.enclosingSourceType().isNestmateOf(codegenBinding.declaringClass) &&
+ (TypeBinding.notEquals(currentScope.enclosingSourceType(), codegenBinding.declaringClass))
&& this.binding.constant(currentScope) == Constant.NotAConstant) {
if (this.syntheticAccessors == null)
this.syntheticAccessors = new MethodBinding[2];
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
index 6d75cb481f..4d6b5d56e9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
@@ -247,6 +247,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
public TypeBinding resolveType(BlockScope blockScope, boolean skipKosherCheck) {
boolean argumentsTypeElided = argumentsTypeElided();
+ boolean argumentsTypeVar = argumentsTypeVar(blockScope);
int argumentsLength = this.arguments == null ? 0 : this.arguments.length;
if (this.constant != Constant.NotAConstant) {
@@ -255,7 +256,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
if (this.original == this)
this.ordinal = recordFunctionalType(blockScope);
- if (!argumentsTypeElided) {
+ if (!argumentsTypeElided && !argumentsTypeVar) {
for (int i = 0; i < argumentsLength; i++)
this.argumentTypes[i] = this.arguments[i].type.resolveType(blockScope, true /* check bounds*/);
}
@@ -288,7 +289,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
int parametersLength = this.descriptor.parameters.length;
if (parametersLength != argumentsLength) {
this.scope.problemReporter().lambdaSignatureMismatched(this);
- if (argumentsTypeElided || this.original != this) // no interest in continuing to error check copy.
+ if (argumentsTypeElided || argumentsTypeVar || this.original != this) // no interest in continuing to error check copy.
return this.resolvedType = null; // FUBAR, bail out ...
else {
this.resolvedType = null; // continue to type check.
@@ -313,7 +314,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
TypeBinding argumentType;
final TypeBinding expectedParameterType = haveDescriptor && i < this.descriptor.parameters.length ? this.descriptor.parameters[i] : null;
- argumentType = argumentsTypeElided ? expectedParameterType : this.argumentTypes[i];
+ argumentType = (argumentsTypeElided || argumentsTypeVar) ? expectedParameterType : this.argumentTypes[i];
if (argumentType == null) {
argumentsHaveErrors = true;
} else if (argumentType == TypeBinding.VOID) {
@@ -328,7 +329,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
}
}
}
- if (!argumentsTypeElided && !argumentsHaveErrors) {
+ if (!argumentsTypeElided && !argumentsTypeVar && !argumentsHaveErrors) {
ReferenceBinding groundType = null;
ReferenceBinding expectedSAMType = null;
if (this.expectedType instanceof IntersectionTypeBinding18)
@@ -359,11 +360,13 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
}
boolean parametersHaveErrors = false;
boolean genericSignatureNeeded = this.requiresGenericSignature || blockScope.compilerOptions().generateGenericSignatureForLambdaExpressions;
+ TypeBinding[] expectedParameterTypes = new TypeBinding[argumentsLength];
for (int i = 0; i < argumentsLength; i++) {
Argument argument = this.arguments[i];
TypeBinding argumentType;
final TypeBinding expectedParameterType = haveDescriptor && i < this.descriptor.parameters.length ? this.descriptor.parameters[i] : null;
- argumentType = argumentsTypeElided ? expectedParameterType : this.argumentTypes[i];
+ argumentType = (argumentsTypeElided || argumentsTypeVar) ? expectedParameterType : this.argumentTypes[i];
+ expectedParameterTypes[i] = expectedParameterType;
if (argumentType != null && argumentType != TypeBinding.VOID) {
if (haveDescriptor && expectedParameterType != null && argumentType.isValidBinding() && TypeBinding.notEquals(argumentType, expectedParameterType)) {
if (expectedParameterType.isProperType(true)) {
@@ -393,6 +396,11 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
}
}
}
+ if (argumentsTypeVar) {
+ for (int i = 0; i < argumentsLength; ++i) {
+ this.arguments[i].type.resolvedType = expectedParameterTypes[i];
+ }
+ }
// only assign parameters if no problems are found
if (!argumentsHaveErrors) {
this.binding.parameters = newParameters;
@@ -400,7 +408,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
this.binding.setParameterAnnotations(parameterAnnotations);
}
- if (!argumentsTypeElided && !argumentsHaveErrors && this.binding.isVarargs()) {
+ if (!argumentsTypeElided && !argumentsTypeVar && !argumentsHaveErrors && this.binding.isVarargs()) {
if (!this.binding.parameters[this.binding.parameters.length - 1].isReifiable()) {
this.scope.problemReporter().possibleHeapPollutionFromVararg(this.arguments[this.arguments.length - 1]);
}
@@ -430,7 +438,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
} // TODO (stephan): else? (can that happen?)
if (haveDescriptor && !argumentsHaveErrors && blockScope.compilerOptions().isAnnotationBasedNullAnalysisEnabled) {
- if (!argumentsTypeElided) {
+ if (!argumentsTypeElided && !argumentsTypeVar) {
AbstractMethodDeclaration.createArgumentBindings(this.arguments, this.binding, this.scope); // includes validation
// no application of null-ness default, hence also no warning regarding redundant null annotation
mergeParameterNullAnnotations(blockScope);
@@ -528,6 +536,27 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
return this.arguments.length > 0 && this.arguments[0].hasElidedType();
}
+ private boolean argumentsTypeVar(BlockScope blockScope) {
+ if (blockScope.compilerOptions().complianceLevel < ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_11)) return false;
+ boolean retval = false, isVar = false, mixReported = false;
+ Argument[] args = this.arguments;
+ for (int i = 0, l = args.length; i < l; ++i) {
+ Argument arg = args[i];
+ TypeReference type = arg.type;
+ if (type == null) continue;
+ boolean prev = isVar;
+ retval |= isVar = type.isTypeNameVar(blockScope);
+ if (i > 0 && prev != isVar && !mixReported) { // report only once per list
+ blockScope.problemReporter().varCannotBeMixedWithNonVarParams(isVar ? arg : args[i - 1]);
+ mixReported = true;
+ }
+ if (isVar && (type.dimensions() > 0 || type.extraDimensions() > 0)) {
+ blockScope.problemReporter().varLocalCannotBeArray(arg);
+ }
+ }
+ return retval;
+ }
+
private void analyzeExceptions() {
ExceptionHandlingFlowContext ehfc;
CompilerOptions compilerOptions = this.scope.compilerOptions();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 09682893b3..2421cfb906 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -493,7 +493,8 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
TypeBinding constantPoolDeclaringClass = CodeStream.getConstantPoolDeclaringClass(currentScope, codegenBinding, this.actualReceiverType, this.receiver.isImplicitThis());
if (isStatic){
codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
- } else if((this.receiver.isSuper()) || codegenBinding.isPrivate()){
+ } else if((this.receiver.isSuper()) ||
+ (!currentScope.enclosingSourceType().isNestmateOf(this.binding.declaringClass) && codegenBinding.isPrivate())){
codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
} else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass, this.typeArguments);
@@ -550,7 +551,8 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
if (this.binding.isPrivate()){
// depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy)
- if (TypeBinding.notEquals(currentScope.enclosingSourceType(), codegenBinding.declaringClass)){
+ if (!currentScope.enclosingSourceType().isNestmateOf(codegenBinding.declaringClass) &&
+ TypeBinding.notEquals(currentScope.enclosingSourceType(), codegenBinding.declaringClass)){
this.syntheticAccessor = ((SourceTypeBinding)codegenBinding.declaringClass).addSyntheticMethod(codegenBinding, false /* not super access there */);
currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this);
return;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
index eb62701838..e9d9103f26 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -904,7 +904,8 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FieldBindi
if (fieldBinding.isPrivate()) { // private access
FieldBinding codegenField = getCodegenBinding(index < 0 ? (this.otherBindings == null ? 0 : this.otherBindings.length) : index);
ReferenceBinding declaringClass = codegenField.declaringClass;
- if (TypeBinding.notEquals(declaringClass, currentScope.enclosingSourceType())) {
+ if (!currentScope.enclosingSourceType().isNestmateOf(declaringClass) &&
+ TypeBinding.notEquals(declaringClass, currentScope.enclosingSourceType())) {
setSyntheticAccessor(fieldBinding, index, ((SourceTypeBinding) declaringClass).addSyntheticMethod(codegenField, index >= 0 /*read-access?*/, false /*not super access*/));
currentScope.problemReporter().needToEmulateFieldAccess(codegenField, this, index >= 0 /*read-access?*/);
return;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
index 3a725ab3eb..c7e4eb8909 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
@@ -440,10 +440,15 @@ public class ReferenceExpression extends FunctionalExpression implements IPolyEx
if (this.isConstructorReference()) {
ReferenceBinding allocatedType = codegenBinding.declaringClass;
- if (codegenBinding.isPrivate() && TypeBinding.notEquals(enclosingSourceType, (allocatedType = codegenBinding.declaringClass))) {
+ if (codegenBinding.isPrivate() &&
+ TypeBinding.notEquals(enclosingSourceType, (allocatedType = codegenBinding.declaringClass))) {
if ((allocatedType.tagBits & TagBits.IsLocalType) != 0) {
codegenBinding.tagBits |= TagBits.ClearPrivateModifier;
} else {
+ if (currentScope.enclosingSourceType().isNestmateOf(this.binding.declaringClass)) {
+ this.syntheticAccessor = codegenBinding;
+ return;
+ }
this.syntheticAccessor = ((SourceTypeBinding) allocatedType).addSyntheticMethod(codegenBinding, false);
currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this);
}
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 b211bf1489..35967ab8fd 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
@@ -928,7 +928,8 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
FieldBinding fieldBinding = (FieldBinding) this.binding;
FieldBinding codegenField = fieldBinding.original();
if (((this.bits & ASTNode.DepthMASK) != 0)
- && (codegenField.isPrivate() // private access
+ && ((codegenField.isPrivate() // private access
+ && !currentScope.enclosingSourceType().isNestmateOf(codegenField.declaringClass) )
|| (codegenField.isProtected() // implicit protected access
&& codegenField.declaringClass.getPackage() != currentScope.enclosingSourceType().getPackage()))) {
if (this.syntheticAccessors == null)
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 fa24be185f..73e4615d54 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
@@ -1248,6 +1248,7 @@ public void resolve() {
reporter.javadocMissing(this.sourceStart, this.sourceEnd, severity, javadocModifiers);
}
}
+ updateNestInfo();
FieldDeclaration[] fieldsDecls = this.fields;
if (fieldsDecls != null) {
for (FieldDeclaration fieldDeclaration : fieldsDecls)
@@ -1553,6 +1554,20 @@ void updateMaxFieldCount() {
}
}
+private SourceTypeBinding findNestHost() {
+ ClassScope classScope = this.scope.enclosingTopMostClassScope();
+ return classScope != null ? classScope.referenceContext.binding : null;
+}
+
+void updateNestInfo() {
+ if (this.binding == null)
+ return;
+ SourceTypeBinding nestHost = findNestHost();
+ if (nestHost != null && !this.binding.equals(nestHost)) {// member
+ this.binding.setNestHost(nestHost);
+ nestHost.addNestMember(this.binding);
+ }
+}
public boolean isPackageInfo() {
return CharOperation.equals(this.name, TypeConstants.PACKAGE_INFO_NAME);
}
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 b5296362ab..70d4378a61 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -83,6 +83,7 @@ public interface ClassFileConstants {
int NameAndTypeTag = 12;
int MethodHandleTag = 15;
int MethodTypeTag = 16;
+ int DynamicTag = 17;
int InvokeDynamicTag = 18;
int ModuleTag = 19;
int PackageTag = 20;
@@ -100,6 +101,7 @@ public interface ClassFileConstants {
int ConstantNameAndTypeFixedSize = 5;
int ConstantMethodHandleFixedSize = 4;
int ConstantMethodTypeFixedSize = 3;
+ int ConstantDynamicFixedSize = 5;
int ConstantInvokeDynamicFixedSize = 5;
int ConstantModuleFixedSize = 3;
int ConstantPackageFixedSize = 3;
@@ -125,12 +127,17 @@ public interface ClassFileConstants {
int MAJOR_VERSION_1_8 = 52;
int MAJOR_VERSION_9 = 53;
int MAJOR_VERSION_10 = 54;
+ int MAJOR_VERSION_11 = 55;
+
+ int MAJOR_VERSION_0 = 44;
+ int MAJOR_LATEST_VERSION = MAJOR_VERSION_11;
int MINOR_VERSION_0 = 0;
int MINOR_VERSION_1 = 1;
int MINOR_VERSION_2 = 2;
int MINOR_VERSION_3 = 3;
int MINOR_VERSION_4 = 4;
+ int MINOR_VERSION_PREVIEW = 0xffff;
// JDK 1.1 -> 9, comparable value allowing to check both major/minor version at once 1.4.1 > 1.4.0
// 16 unsigned bits for major, then 16 bits for minor
@@ -144,7 +151,29 @@ public interface ClassFileConstants {
long JDK1_8 = ((long)ClassFileConstants.MAJOR_VERSION_1_8 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK9 = ((long)ClassFileConstants.MAJOR_VERSION_9 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK10 = ((long)ClassFileConstants.MAJOR_VERSION_10 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK11 = ((long)ClassFileConstants.MAJOR_VERSION_11 << 16) + ClassFileConstants.MINOR_VERSION_0;
+
+ public static long getLatestJDKLevel() {
+ return ((long)ClassFileConstants.MAJOR_LATEST_VERSION << 16) + ClassFileConstants.MINOR_VERSION_0;
+ }
+ /**
+ * As we move away from declaring every compliance level explicitly (such as JDK11, JDK12 etc.),
+ * this method can be used to compute the compliance level on the fly for a given Java major version.
+ *
+ * @param major Java major version
+ * @return the compliance level for the given Java version
+ */
+ public static long getComplianceLevelForJavaVersion(int major) {
+ switch(major) {
+ case ClassFileConstants.MAJOR_VERSION_1_1:
+ return ((long)ClassFileConstants.MAJOR_VERSION_1_1 << 16) + ClassFileConstants.MINOR_VERSION_3;
+ default:
+ if (major <= MAJOR_LATEST_VERSION)
+ return ((long)major << 16) + ClassFileConstants.MINOR_VERSION_0;
+ }
+ return 0;
+ }
/*
* cldc1.1 is 45.3, but we modify it to be different from JDK1_1.
* In the code gen, we will generate the same target value as JDK1_1
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 4a3882142d..64902f4a4f 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
@@ -78,6 +78,9 @@ public class ClassFileReader extends ClassFileStruct implements IBinaryType {
private char[][][] missingTypeNames;
private int enclosingNameAndTypeIndex;
private char[] enclosingMethod;
+ private char[] nestHost;
+ private int nestMembersCount;
+ private char[][] nestMembers;
private static String printTypeModifiers(int modifiers) {
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
@@ -259,6 +262,10 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit
this.constantPoolOffsets[i] = readOffset;
readOffset += ClassFileConstants.ConstantMethodTypeFixedSize;
break;
+ case ClassFileConstants.DynamicTag :
+ this.constantPoolOffsets[i] = readOffset;
+ readOffset += ClassFileConstants.ConstantDynamicFixedSize;
+ break;
case ClassFileConstants.InvokeDynamicTag :
this.constantPoolOffsets[i] = readOffset;
readOffset += ClassFileConstants.ConstantInvokeDynamicFixedSize;
@@ -433,6 +440,27 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit
this.moduleDeclaration = ModuleInfo.createModule(this.reference, this.constantPoolOffsets, readOffset);
this.moduleName = this.moduleDeclaration.name();
}
+ break;
+ case 'N' :
+ if (CharOperation.equals(attributeName, AttributeNamesConstants.NestHost)) {
+ utf8Offset =
+ this.constantPoolOffsets[u2At(this.constantPoolOffsets[u2At(readOffset + 6)] + 1)];
+ this.nestHost = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ } else if (CharOperation.equals(attributeName, AttributeNamesConstants.NestMembers)) {
+ int offset = readOffset + 6;
+ this.nestMembersCount = u2At(offset);
+ if (this.nestMembersCount != 0) {
+ offset += 2;
+ this.nestMembers = new char[this.nestMembersCount][];
+ for (int j = 0; j < this.nestMembersCount; j++) {
+ utf8Offset =
+ this.constantPoolOffsets[u2At(this.constantPoolOffsets[u2At(offset)] + 1)];
+ this.nestMembers[j] = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ offset += 2;
+ }
+ }
+ }
+ break;
}
readOffset += (6 + u4At(readOffset + 2));
}
@@ -453,6 +481,10 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit
}
}
+public char[] getNestHost() {
+ return this.nestHost;
+}
+
@Override
public ExternalAnnotationStatus getExternalAnnotationStatus() {
return ExternalAnnotationStatus.NOT_EEA_CONFIGURED;
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 fa3e8c55d8..5426cbc9fd 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
@@ -50,4 +50,7 @@ public interface AttributeNamesConstants {
final char[] RuntimeInvisibleTypeAnnotationsName = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
// jep118
final char[] MethodParametersName = "MethodParameters".toCharArray(); //$NON-NLS-1$
+ // jep181
+ final char[] NestHost = "NestHost".toCharArray(); //$NON-NLS-1$
+ final char[] NestMembers = "NestMembers".toCharArray(); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
index 0423de45d4..276c999ed2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
@@ -895,7 +895,7 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
return index;
}
- public int literalIndexForInvokeDynamic(int bootStrapIndex, char[] selector, char[] descriptor) {
+ private int literalIndexForInvokeAndConstantDynamic(int bootStrapIndex, char[] selector, char[] descriptor, int tag) {
int index;
if ((index = putInDynamicCacheIfAbsent(bootStrapIndex, selector, descriptor, this.currentIndex)) < 0) {
this.currentIndex++;
@@ -909,7 +909,7 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
}
this.offsets[index] = this.currentOffset;
- writeU1(InvokeDynamicTag);
+ writeU1(tag);
int classIndexOffset = this.currentOffset;
if (this.currentOffset + 4 >= this.poolContent.length) {
resizePoolContents(4);
@@ -925,6 +925,13 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
}
return index;
}
+ // CONSTANT_Dynamic_info JVMS 4.4.10 /jep 309
+ public int literalIndexForDynamic(int bootStrapIndex, char[] selector, char[] descriptor) {
+ return literalIndexForInvokeAndConstantDynamic(bootStrapIndex, selector, descriptor, DynamicTag);
+ }
+ public int literalIndexForInvokeDynamic(int bootStrapIndex, char[] selector, char[] descriptor) {
+ return literalIndexForInvokeAndConstantDynamic(bootStrapIndex, selector, descriptor, InvokeDynamicTag);
+ }
public int literalIndexForField(char[] declaringClass, char[] name, char[] signature) {
int index;
if ((index = putInCacheIfAbsent(declaringClass, name, signature, this.currentIndex)) < 0) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.java
index afd754dfa2..3991a32148 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.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:
* Stephan Herrmann - initial API and implementation
*******************************************************************************/
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 17fe4bb0b4..b09fa0512b 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
@@ -202,6 +202,8 @@ public class CompilerOptions {
public static final String OPTION_ReportAPILeak = "org.eclipse.jdt.core.compiler.problem.APILeak"; //$NON-NLS-1$
public static final String OPTION_ReportUnstableAutoModuleName = "org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName"; //$NON-NLS-1$
+ public static final String OPTION_EnablePreviews = "org.eclipse.jdt.core.compiler.problem.EnablePreviews"; //$NON-NLS-1$
+
/**
* Possible values for configurable options
*/
@@ -221,6 +223,7 @@ public class CompilerOptions {
public static final String VERSION_1_8 = "1.8"; //$NON-NLS-1$
public static final String VERSION_9 = "9"; //$NON-NLS-1$
public static final String VERSION_10 = "10"; //$NON-NLS-1$
+ public static final String VERSION_11 = "11"; //$NON-NLS-1$
public static final String ERROR = "error"; //$NON-NLS-1$
public static final String WARNING = "warning"; //$NON-NLS-1$
public static final String INFO = "info"; //$NON-NLS-1$
@@ -330,6 +333,8 @@ public class CompilerOptions {
public static final int UsingTerminallyDeprecatedAPI = IrritantSet.GROUP2 | ASTNode.Bit24;
public static final int APILeak = IrritantSet.GROUP2 | ASTNode.Bit25;
public static final int UnstableAutoModuleName = IrritantSet.GROUP2 | ASTNode.Bit26;
+ // Dummy feature, but
+ //public static final int DummyPreviewFeatureWarning = IrritantSet.GROUP2 | ASTNode.Bit27;
// Severity level for handlers
@@ -515,6 +520,9 @@ public class CompilerOptions {
/** Not directly configurable, derived from other options by LookupEnvironment.usesNullTypeAnnotations() */
public Boolean useNullTypeAnnotations = null;
+ /** Master flag to enabled/disable all preview features */
+ public boolean enablePreviewFeatures;
+
// keep in sync with warningTokenToIrritant and warningTokenFromIrritant
public final static String[] warningTokens = {
"all", //$NON-NLS-1$
@@ -545,6 +553,7 @@ public class CompilerOptions {
"unlikely-arg-type", //$NON-NLS-1$
"unqualified-field-access", //$NON-NLS-1$
"unused", //$NON-NLS-1$
+ "preview", //$NON-NLS-1$
};
/**
@@ -754,7 +763,8 @@ public class CompilerOptions {
}
public static String versionFromJdkLevel(long jdkLevel) {
- switch ((int)(jdkLevel>>16)) {
+ int major = (int)(jdkLevel>>16);
+ switch (major) {
case ClassFileConstants.MAJOR_VERSION_1_1 :
if (jdkLevel == ClassFileConstants.JDK1_1)
return VERSION_1_1;
@@ -792,32 +802,25 @@ public class CompilerOptions {
return VERSION_9;
break;
case ClassFileConstants.MAJOR_VERSION_10 :
- // JDK10 uses same major version ad JDK9
if (jdkLevel == ClassFileConstants.JDK10)
return VERSION_10;
break;
+ default:
+ if(major > ClassFileConstants.MAJOR_VERSION_10) {
+ return "" + (major - ClassFileConstants.MAJOR_VERSION_0); //$NON-NLS-1$
+ }
+ return Util.EMPTY_STRING; // unknown version
+
}
return Util.EMPTY_STRING; // unknown version
}
public static long releaseToJDKLevel(String release) {
if (release != null && release.length() > 0) {
- switch(release.charAt(0)) {
- case '6':
- return ClassFileConstants.JDK1_6;
- case '7':
- return ClassFileConstants.JDK1_7;
- case '8':
- return ClassFileConstants.JDK1_8;
- case '9':
- return ClassFileConstants.JDK9;
- case '1':
- if (release.length() > 1 && release.charAt(1) == '0')
- return ClassFileConstants.JDK10;
- else
- return 0;
- default:
- return 0; // unknown
+ int major = Integer.parseInt(release) + ClassFileConstants.MAJOR_VERSION_0;
+ if (major <= ClassFileConstants.MAJOR_LATEST_VERSION) {
+ long jdkLevel = ((long) major << 16) + ClassFileConstants.MINOR_VERSION_0;
+ return jdkLevel;
}
}
return 0;
@@ -848,19 +851,22 @@ public class CompilerOptions {
return 0; // unknown
}
} else {
- switch (version.charAt(0)) {
- case '9':
- return ClassFileConstants.JDK9;
- case '1':
- if (version.length() > 1 && version.charAt(1) == '0') {
- return ClassFileConstants.JDK10; // Level for JDK 10
- } else {
- int versionAfterTen = Integer.parseInt("" + version.charAt(1)); //$NON-NLS-1$
- int majorVersion = ClassFileConstants.MAJOR_VERSION_10 + versionAfterTen;
- long jdkLevel = ((long)majorVersion << 16) + ClassFileConstants.MINOR_VERSION_0;
- return jdkLevel;
- }
- // No default - let it go through the remaining checks.
+ try {
+ int index = version.indexOf('.');
+ if (index != -1) {
+ version = version.substring(0, index);
+ } else {
+ index = version.indexOf('-');
+ if (index != -1)
+ version = version.substring(0, index);
+ }
+ int major = Integer.parseInt(version) + ClassFileConstants.MAJOR_VERSION_0;
+ if (major <= ClassFileConstants.MAJOR_LATEST_VERSION) {
+ long jdkLevel = ((long) major << 16) + ClassFileConstants.MINOR_VERSION_0;
+ return jdkLevel;
+ }
+ } catch (NumberFormatException e) {
+ // do nothing and return 0 at the end
}
}
}
@@ -1087,6 +1093,8 @@ public class CompilerOptions {
return "exports"; //$NON-NLS-1$
case UnstableAutoModuleName:
return "module"; //$NON-NLS-1$
+ //case DummyPreviewFeatureWarning:
+ // return "preview"; //$NON-NLS-1$
}
return null;
}
@@ -1145,6 +1153,11 @@ public class CompilerOptions {
if ("null".equals(warningToken)) //$NON-NLS-1$
return IrritantSet.NULL;
break;
+ case 'p' :
+ if ("preview".equals(warningToken)) { //$NON-NLS-1$
+ return IrritantSet.PREVIEW;
+ }
+ break;
case 'r' :
if ("rawtypes".equals(warningToken)) //$NON-NLS-1$
return IrritantSet.RAW;
@@ -1331,6 +1344,7 @@ public class CompilerOptions {
optionsMap.put(OPTION_ReportUnlikelyEqualsArgumentType, getSeverityString(UnlikelyEqualsArgumentType));
optionsMap.put(OPTION_ReportAPILeak, getSeverityString(APILeak));
optionsMap.put(OPTION_ReportUnstableAutoModuleName, getSeverityString(UnstableAutoModuleName));
+ optionsMap.put(OPTION_EnablePreviews, this.enablePreviewFeatures ? ENABLED : DISABLED);
return optionsMap;
}
@@ -1529,6 +1543,7 @@ public class CompilerOptions {
this.reportMissingEnumCaseDespiteDefault = false;
this.complainOnUninternedIdentityComparison = false;
+ this.enablePreviewFeatures = false;
}
public void set(Map<String, String> optionsMap) {
@@ -1607,6 +1622,9 @@ public class CompilerOptions {
if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
long level = versionToJdkLevel(optionValue);
if (level != 0) {
+ if (this.enablePreviewFeatures) {
+ level |= ClassFileConstants.MINOR_VERSION_PREVIEW;
+ }
this.targetJDK = level;
}
if (this.targetJDK >= ClassFileConstants.JDK1_5) this.inlineJsrBytecode = true; // forced from 1.5 mode on
@@ -2037,6 +2055,15 @@ public class CompilerOptions {
this.complainOnUninternedIdentityComparison = false;
}
}
+ if ((optionValue = optionsMap.get(OPTION_EnablePreviews)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.enablePreviewFeatures = true;
+ if (this.targetJDK != 0)
+ this.targetJDK |= ClassFileConstants.MINOR_VERSION_PREVIEW;
+ } else if (DISABLED.equals(optionValue)) {
+ this.enablePreviewFeatures = false;
+ }
+ }
}
private String[] stringToNameList(String optionValue) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
index b919ed94ac..735f553600 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
@@ -77,6 +77,7 @@ public class IrritantSet {
public static final IrritantSet MODULE = new IrritantSet(CompilerOptions.UnstableAutoModuleName);
public static final IrritantSet JAVADOC = new IrritantSet(CompilerOptions.InvalidJavadoc);
+ public static final IrritantSet PREVIEW = new IrritantSet(0);
public static final IrritantSet COMPILER_DEFAULT_ERRORS = new IrritantSet(0); // no optional error by default
public static final IrritantSet COMPILER_DEFAULT_WARNINGS = new IrritantSet(0); // see static initializer below
public static final IrritantSet COMPILER_DEFAULT_INFOS = new IrritantSet(0); // As of now, no default values
@@ -189,9 +190,10 @@ public class IrritantSet {
UNLIKELY_ARGUMENT_TYPE
.set(CompilerOptions.UnlikelyEqualsArgumentType);
+ //PREVIEW.set(CompilerOptions.DummyPreviewFeatureWarning);
}
-
// Internal state
+
private int[] bits = new int[GROUP_MAX];
/**
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 3175c57960..90e9f6757c 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
@@ -1279,6 +1279,23 @@ public boolean isClass() {
return (this.modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) == 0;
}
+private static SourceTypeBinding getSourceTypeBinding(ReferenceBinding ref) {
+ if (ref instanceof SourceTypeBinding)
+ return (SourceTypeBinding) ref;
+ if (ref instanceof ParameterizedTypeBinding) {
+ ParameterizedTypeBinding ptb = (ParameterizedTypeBinding) ref;
+ return ptb.type instanceof SourceTypeBinding ? (SourceTypeBinding) ptb.type : null;
+ }
+ return null;
+}
+public boolean isNestmateOf(ReferenceBinding other) {
+ SourceTypeBinding s1 = getSourceTypeBinding(this);
+ SourceTypeBinding s2 = getSourceTypeBinding(other);
+ if (s1 == null || s2 == null) return false;
+
+ return s1.isNestmateOf(s2);
+}
+
@Override
public boolean isProperType(boolean admitCapture18) {
ReferenceBinding outer = enclosingType();
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 000a3c3463..eae863ffc9 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
@@ -1138,6 +1138,15 @@ public abstract class Scope {
return null; // may answer null if no type around
}
+ public final ClassScope enclosingTopMostClassScope() {
+ Scope scope = this;
+ while (scope != null) {
+ Scope t = scope.parent;
+ if (t instanceof CompilationUnitScope) break;
+ scope = t;
+ }
+ return scope instanceof ClassScope ? ((ClassScope) scope) : null;
+ }
public final MethodScope enclosingMethodScope() {
Scope scope = this;
while ((scope = scope.parent) != null) {
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 b43b1b338f..e280b335fd 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,7 +53,10 @@ package org.eclipse.jdt.internal.compiler.lookup;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Collectors;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
@@ -113,6 +116,9 @@ public class SourceTypeBinding extends ReferenceBinding {
public ExternalAnnotationProvider externalAnnotationProvider;
+ private SourceTypeBinding nestHost;
+ public HashSet<SourceTypeBinding> nestMembers;
+
public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) {
this.compoundName = compoundName;
this.fPackage = fPackage;
@@ -2625,4 +2631,42 @@ public ModuleBinding module() {
return this.prototype.module;
return this.module;
}
+
+public SourceTypeBinding getNestHost() {
+ return this.nestHost;
+}
+
+public void setNestHost(SourceTypeBinding nestHost) {
+ this.nestHost = nestHost;
}
+
+public boolean isNestmateOf(SourceTypeBinding other) {
+
+ CompilerOptions options = this.scope.compilerOptions();
+ if (options.targetJDK < ClassFileConstants.JDK11 ||
+ options.complianceLevel < ClassFileConstants.JDK11)
+ return false; // default false if level less than 11
+
+ SourceTypeBinding otherHost = other.getNestHost();
+ return TypeBinding.equalsEquals(this, other) ||
+ TypeBinding.equalsEquals(this.nestHost == null ? this : this.nestHost,
+ otherHost == null ? other : otherHost);
+}
+public void addNestMember(SourceTypeBinding member) {
+ if (this.nestMembers == null) {
+ this.nestMembers = new HashSet<>();
+ }
+ this.nestMembers.add(member);
+}
+public List<String> getNestMembers() {
+ if (this.nestMembers == null)
+ return null;
+ List<String> list = this.nestMembers
+ .stream()
+ .map(s -> new String(s.constantPoolName()))
+ .sorted()
+ .collect(Collectors.toList());
+ return list;
+}
+
+} \ No newline at end of file
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 0e73d30908..64077fde76 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, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -155,6 +155,8 @@ public interface JavadocTagConstants {
// since 9
{},
// since 10
+ {},
+ // since 11
{}
};
public static final char[][][] INLINE_TAGS = {
@@ -179,6 +181,8 @@ public interface JavadocTagConstants {
// since 9
{},
// since 10
+ {},
+ // since 11
{}
};
public final static int INLINE_TAGS_LENGTH = INLINE_TAGS.length;
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 3a5b7af4e8..c9bf5ce3bc 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, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 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 ScannerHelper {
private static long[][][] Tables7;
private static long[][][] Tables8;
private static long[][][] Tables9;
+ private static long[][][] Tables11;
public final static int MAX_OBVIOUS = 128;
public final static int[] OBVIOUS_IDENT_CHAR_NATURES = new int[MAX_OBVIOUS];
@@ -147,95 +148,84 @@ static void initializeTable18() {
static void initializeTable19() {
Tables9 = initializeTables("unicode8"); //$NON-NLS-1$
}
+static void initializeTableJava11() {
+ Tables11 = initializeTables("unicode10"); //$NON-NLS-1$
+}
static long[][][] initializeTables(String unicode_path) {
long[][][] tempTable = new long[2][][];
tempTable[START_INDEX] = new long[3][];
tempTable[PART_INDEX] = new long[4][];
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start0.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[START_INDEX][0] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start1.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[START_INDEX][1] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/start2.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[START_INDEX][2] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part0.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[PART_INDEX][0] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part1.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[PART_INDEX][1] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part2.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[PART_INDEX][2] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
- try {
- DataInputStream inputStream = new DataInputStream(new BufferedInputStream(ScannerHelper.class.getResourceAsStream(unicode_path + "/part14.rsc"))); //$NON-NLS-1$
+ 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();
}
- inputStream.close();
tempTable[PART_INDEX][3] = readValues;
} catch (FileNotFoundException e) {
e.printStackTrace();
@@ -263,68 +253,50 @@ public static boolean isJavaIdentifierPart(long complianceLevel, char c) {
}
return isJavaIdentifierPart(complianceLevel, (int) c);
}
+private static boolean isJavaIdentifierPart0(int codePoint, long[][][] tables) {
+ switch((codePoint & 0x1F0000) >> 16) {
+ case 0 :
+ return isBitSet(tables[PART_INDEX][0], codePoint & 0xFFFF);
+ case 1 :
+ return isBitSet(tables[PART_INDEX][1], codePoint & 0xFFFF);
+ case 2 :
+ return isBitSet(tables[PART_INDEX][2], codePoint & 0xFFFF);
+ case 14 :
+ return isBitSet(tables[PART_INDEX][3], codePoint & 0xFFFF);
+ }
+ return false;
+}
public static boolean isJavaIdentifierPart(long complianceLevel, int codePoint) {
if (complianceLevel <= ClassFileConstants.JDK1_6) {
if (Tables == null) {
initializeTable();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables[PART_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables[PART_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables[PART_INDEX][2], codePoint & 0xFFFF);
- case 14 :
- return isBitSet(Tables[PART_INDEX][3], codePoint & 0xFFFF);
- }
+ return isJavaIdentifierPart0(codePoint, Tables);
} else if (complianceLevel <= ClassFileConstants.JDK1_7) {
// java 7 supports Unicode 6
if (Tables7 == null) {
initializeTable17();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables7[PART_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables7[PART_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables7[PART_INDEX][2], codePoint & 0xFFFF);
- case 14 :
- return isBitSet(Tables7[PART_INDEX][3], codePoint & 0xFFFF);
- }
+ return isJavaIdentifierPart0(codePoint, Tables7);
} else if (complianceLevel <= ClassFileConstants.JDK1_8) {
// java 8 supports Unicode 6.2
if (Tables8 == null) {
initializeTable18();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables8[PART_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables8[PART_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables8[PART_INDEX][2], codePoint & 0xFFFF);
- case 14 :
- return isBitSet(Tables8[PART_INDEX][3], codePoint & 0xFFFF);
- }
- } else {
- // java 9 supports Unicode 8
+ return isJavaIdentifierPart0(codePoint, Tables8);
+ } else if (complianceLevel <= ClassFileConstants.JDK10) {
+ // java 9/10 supports Unicode 8
if (Tables9 == null) {
initializeTable19();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables9[PART_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables9[PART_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables9[PART_INDEX][2], codePoint & 0xFFFF);
- case 14 :
- return isBitSet(Tables9[PART_INDEX][3], codePoint & 0xFFFF);
+ return isJavaIdentifierPart0(codePoint, Tables9);
+ } else {
+ // java 11 supports Unicode 10
+ if (Tables11 == null) {
+ initializeTableJava11();
}
+ return isJavaIdentifierPart0(codePoint, Tables11);
}
- return false;
}
public static boolean isJavaIdentifierPart(long complianceLevel, char high, char low) {
return isJavaIdentifierPart(complianceLevel, toCodePoint(high, low));
@@ -344,60 +316,48 @@ public static boolean isJavaIdentifierStart(long complianceLevel, char c) {
public static boolean isJavaIdentifierStart(long complianceLevel, char high, char low) {
return isJavaIdentifierStart(complianceLevel, toCodePoint(high, low));
}
+private static boolean isJavaIdentifierStart0(int codePoint, long[][][] tables) {
+ switch((codePoint & 0x1F0000) >> 16) {
+ case 0 :
+ return isBitSet(tables[START_INDEX][0], codePoint & 0xFFFF);
+ case 1 :
+ return isBitSet(tables[START_INDEX][1], codePoint & 0xFFFF);
+ case 2 :
+ return isBitSet(tables[START_INDEX][2], codePoint & 0xFFFF);
+ }
+ return false;
+}
public static boolean isJavaIdentifierStart(long complianceLevel, int codePoint) {
if (complianceLevel <= ClassFileConstants.JDK1_6) {
if (Tables == null) {
initializeTable();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables[START_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables[START_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables[START_INDEX][2], codePoint & 0xFFFF);
- }
+ return isJavaIdentifierStart0(codePoint, Tables);
} else if (complianceLevel <= ClassFileConstants.JDK1_7) {
// java 7 supports Unicode 6
if (Tables7 == null) {
initializeTable17();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables7[START_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables7[START_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables7[START_INDEX][2], codePoint & 0xFFFF);
- }
+ return isJavaIdentifierStart0(codePoint, Tables7);
} else if (complianceLevel <= ClassFileConstants.JDK1_8) {
- // java 7 supports Unicode 6
+ // java 8 supports Unicode 6.2
if (Tables8 == null) {
initializeTable18();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables8[START_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables8[START_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables8[START_INDEX][2], codePoint & 0xFFFF);
- }
- } else {
- // java 9 supports Unicode 7
+ return isJavaIdentifierStart0(codePoint, Tables8);
+ } else if (complianceLevel <= ClassFileConstants.JDK10) {
+ // java 9/10 supports Unicode 8
if (Tables9 == null) {
initializeTable19();
}
- switch((codePoint & 0x1F0000) >> 16) {
- case 0 :
- return isBitSet(Tables9[START_INDEX][0], codePoint & 0xFFFF);
- case 1 :
- return isBitSet(Tables9[START_INDEX][1], codePoint & 0xFFFF);
- case 2 :
- return isBitSet(Tables9[START_INDEX][2], codePoint & 0xFFFF);
+ return isJavaIdentifierStart0(codePoint, Tables9);
+ } else {
+ // java 11 supports Unicode 10
+ if (Tables11 == null) {
+ initializeTableJava11();
}
+ return isJavaIdentifierStart0(codePoint, Tables11);
}
- return false;
}
private static int toCodePoint(char high, char low) {
return (high - Scanner.HIGH_SURROGATE_MIN_VALUE) * 0x400 + (low - Scanner.LOW_SURROGATE_MIN_VALUE) + 0x10000;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rsc
new file mode 100644
index 0000000000..c2a638fda6
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rsc
new file mode 100644
index 0000000000..87cad854ec
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rsc
new file mode 100644
index 0000000000..c8241e80d5
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc
new file mode 100644
index 0000000000..ab6b33ed48
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rsc
new file mode 100644
index 0000000000..a41623669e
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rsc
new file mode 100644
index 0000000000..5856a2aadd
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc
new file mode 100644
index 0000000000..ab6b33ed48
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.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 873e8023ee..69eed52349 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
@@ -9469,6 +9469,14 @@ public void varIsNotAllowedHere(ASTNode astNode) {
astNode.sourceStart,
astNode.sourceEnd);
}
+public void varCannotBeMixedWithNonVarParams(ASTNode astNode) {
+ this.handle(
+ IProblem.VarCannotBeMixedWithNonVarParams,
+ NoArgument,
+ NoArgument,
+ astNode.sourceStart,
+ astNode.sourceEnd);
+}
public void variableTypeCannotBeVoidArray(AbstractVariableDeclaration varDecl) {
this.handle(
IProblem.CannotAllocateVoidArray,
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 bc10d230c4..59acc731cf 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
@@ -964,6 +964,7 @@
1509 = 'var' is not a valid type name
1510 = 'var' should not be used as an type name, since it is a reserved word from source level 10 on
1511 = 'var' is not allowed here
+1512 = 'var' cannot be mixed with non-var parameters
### ELABORATIONS
## Access restrictions
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 de74c5638b..49d5138600 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
@@ -237,6 +237,7 @@ public final class AST {
* </p>
*
* @since 3.14
+ * @deprecated Clients should use the {@link #JLS11} AST API instead.
*/
public static final int JLS10 = 10;
@@ -247,6 +248,29 @@ public final class AST {
*/
/*package*/ static final int JLS10_INTERNAL = JLS10;
+ /**
+ * Constant for indicating the AST API that handles JLS11.
+ * <p>
+ * This API is capable of handling all constructs in the
+ * Java language as described in the Java Language
+ * Specification, Java SE 11 Edition (JLS11).
+ * JLS11 is a superset of all earlier versions of the
+ * Java language, and the JLS11 API can be used to manipulate
+ * programs written in all versions of the Java language
+ * up to and including Java SE 11 (aka JDK 11).
+ * </p>
+ *
+ * @since 3.15 BETA_JAVA11
+ */
+ public static final int JLS11 = 11;
+
+ /**
+ * Internal synonym for {@link #JLS11}. Use to alleviate
+ * deprecation warnings once JLS11 is deprecated
+ * @since 3.14 BETA_JAVA11
+ */
+ /*package*/ static final int JLS11_INTERNAL = JLS11;
+
/*
* Must not collide with a value for ICompilationUnit constants
*/
@@ -813,6 +837,20 @@ public final class AST {
null/*taskPriorities*/,
true/*taskCaseSensitive*/);
break;
+ case JLS11_INTERNAL :
+ this.apiLevel = level;
+ // initialize a scanner
+ long compliance = ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_11);
+ this.scanner = new Scanner(
+ true /*comment*/,
+ true /*whitespace*/,
+ false /*nls*/,
+ compliance /*sourceLevel*/,
+ compliance /*complianceLevel*/,
+ null/*taskTag*/,
+ null/*taskPriorities*/,
+ true/*taskCaseSensitive*/);
+ break;
default:
throw new IllegalArgumentException("Unsupported JLS level"); //$NON-NLS-1$
}
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 cffd5d0b9c..5c45e5c852 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
@@ -2057,6 +2057,21 @@ public abstract class ASTNode {
}
}
/**
+ * Checks that this AST operation is not used when
+ * building JLS2, JLS3, JLS4, JLS8, JLS9 or JLS10 level ASTs.
+ * <p>
+ * Use this method to prevent access to new properties that have been added in JLS11
+ * </p>
+ *
+ * @exception UnsupportedOperationException if this operation is used below JLS11
+ * @since 3.14 BETA_JAVA11
+ */
+ final void unsupportedBelow11() {
+ if (this.ast.apiLevel < AST.JLS11_INTERNAL) {
+ throw new UnsupportedOperationException("Operation only supported in ASTs with level JLS11 and above"); //$NON-NLS-1$
+ }
+ }
+ /**
* Checks that this AST operation is only used when
* building JLS2 level ASTs.
* <p>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
index 23a3c56c22..c202eb295a 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
@@ -233,6 +233,7 @@ public class ASTParser {
case AST.JLS8_INTERNAL:
case AST.JLS9_INTERNAL:
case AST.JLS10_INTERNAL:
+ case AST.JLS11_INTERNAL:
break;
default:
throw new IllegalArgumentException();
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 2a80d49c37..1e01c1214f 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
@@ -1315,7 +1315,7 @@ public final class ImportRewrite {
CompilationUnit usedAstRoot= this.astRoot;
if (usedAstRoot == null) {
- ASTParser parser= ASTParser.newParser(AST.JLS10);
+ ASTParser parser= ASTParser.newParser(AST.JLS11);
parser.setSource(this.compilationUnit);
parser.setFocalPosition(0); // reduced AST
parser.setResolveBindings(false);
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 27ff0f3dd0..c880fde6fa 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
@@ -341,7 +341,7 @@ public final class JavaCore extends Plugin {
* <p><code>"cldc1.1"</code> requires the source version to be <code>"1.3"</code> and the compliance version to be <code>"1.4"</code> or lower.</p>
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.codegen.targetPlatform"</code></dd>
- * <dt>Possible values:</dt><dd><code>{ "1.1", "cldc1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "9", "10" }</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "1.1", "cldc1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "9", "10", "11" }</code></dd>
* <dt>Default:</dt><dd><code>"1.2"</code></dd>
* </dl>
* @category CompilerOptionID
@@ -2061,7 +2061,7 @@ public final class JavaCore extends Plugin {
* set to the same version as the source level.</p>
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.source"</code></dd>
- * <dt>Possible values:</dt><dd><code>{ "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "10" }</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "9", "10", "11" }</code></dd>
* <dt>Default:</dt><dd><code>"1.3"</code></dd>
* </dl>
* @since 2.0
@@ -2079,7 +2079,7 @@ public final class JavaCore extends Plugin {
* should match the compliance setting.</p>
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.compliance"</code></dd>
- * <dt>Possible values:</dt><dd><code>{ "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "9", "10" }</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "9", "10", "11" }</code></dd>
* <dt>Default:</dt><dd><code>"1.4"</code></dd>
* </dl>
* @since 2.0
@@ -3008,20 +3008,28 @@ public final class JavaCore extends Plugin {
public static final String VERSION_10 = "10"; //$NON-NLS-1$
/**
* Configurable option value: {@value}.
+ * @since 3.15 BETA_JAVA11
+ * @category OptionValue
+ */
+ public static final String VERSION_11 = "11"; //$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 = 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);
/**
- * Returns all {@link JavaCore}{@code #VERSION_*} levels.
+ * Returns all {@link JavaCore}{@code #VERSION_*} levels in the order of their
+ * introduction. For e.g., {@link JavaCore#VERSION_1_8} appears before {@link JavaCore#VERSION_10}
*
* @return all available versions
* @since 3.14
*/
public static List<String> getAllVersions() {
- return 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);
+ return allVersions;
}
/**
@@ -5931,7 +5939,9 @@ public final class JavaCore extends Plugin {
* @since 3.3
*/
public static void setComplianceOptions(String compliance, Map options) {
- switch((int) (CompilerOptions.versionToJdkLevel(compliance) >>> 16)) {
+ long jdkLevel = CompilerOptions.versionToJdkLevel(compliance);
+ int major = (int) (jdkLevel >>> 16);
+ switch(major) {
case ClassFileConstants.MAJOR_VERSION_1_3:
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3);
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
@@ -5996,6 +6006,18 @@ public final class JavaCore extends Plugin {
options.put(JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE, JavaCore.ENABLED);
options.put(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED);
break;
+ default:
+ if(major > ClassFileConstants.MAJOR_VERSION_10) {
+ String version = CompilerOptions.versionFromJdkLevel(jdkLevel);
+ options.put(JavaCore.COMPILER_COMPLIANCE, version);
+ options.put(JavaCore.COMPILER_SOURCE, version);
+ options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, version);
+ options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE, JavaCore.ENABLED);
+ options.put(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED);
+ }
+ break;
}
}
@@ -6023,6 +6045,16 @@ public final class JavaCore extends Plugin {
}
/**
+ * Returns the latest version of Java supported by the Java Model. This is usually the last entry
+ * from {@link JavaCore#getAllVersions()}.
+ *
+ * @since 3.15
+ * @return the latest Java version support by Java Model
+ */
+ public static String latestSupportedJavaVersion() {
+ return allVersions.get(allVersions.size() - 1);
+ }
+ /**
* Compares two given versions of the Java platform. The versions being compared must both be
* one of the supported values mentioned in
* {@link #COMPILER_CODEGEN_TARGET_PLATFORM COMPILER_CODEGEN_TARGET_PLATFORM},
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 600d6b1013..fd0e129e0c 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -190,4 +190,17 @@ public interface IAttributeNamesConstants {
* @since 3.14
*/
char[] MODULE_MAIN_CLASS = "ModuleMainClass".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "NestHost" attribute (JVMS 11).
+ * @since 3.15 BETA_JAVA11
+ */
+ char[] NEST_HOST = "NestHost".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "NestMembers" attribute (JVMS 11).
+ * @since 3.15 BETA_JAVA11
+ */
+ char[] NEST_MEMBERS = "NestMembers".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 ea19a8ab19..d0a818ef0d 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, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -117,6 +117,16 @@ public interface IClassFileReader {
IInnerClassesAttribute getInnerClassesAttribute();
/**
+ * Answer back the nest members attribute of this .class file, null if none.
+ *
+ * @return the nest members attribute of this .class file, null if none
+ * @since 3.15 BETA_JAVA11
+ */
+ default INestMembersAttribute getNestMembersAttribute() {
+ 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/IConstantPool.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java
index 6ee992ed0e..01b7ff6f6e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -42,7 +42,9 @@ public interface IConstantPool {
*
* <p>The return value can be an instance of {@link IConstantPoolEntry2} if the value returned
* by {@link #getEntryKind(int)} is either {@link IConstantPoolConstant#CONSTANT_MethodHandle},
- * {@link IConstantPoolConstant#CONSTANT_MethodType} or {@link IConstantPoolConstant#CONSTANT_InvokeDynamic}.</p>
+ * {@link IConstantPoolConstant#CONSTANT_MethodType},
+ * {@link IConstantPoolConstant#CONSTANT_InvokeDynamic},
+ * {@link IConstantPoolConstant#CONSTANT_Dynamic}.</p>
*
* <p>The return value can be an instance of {@link IConstantPoolEntry3} if the value returned
* by {@link #getEntryKind(int)} is either {@link IConstantPoolConstant#CONSTANT_Module}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java
index 60d85201a8..40e6ee5fae 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -44,7 +44,12 @@ public interface IConstantPoolConstant {
* @since 3.8
*/
int CONSTANT_InvokeDynamic = 18;
-
+ /**
+ * proposed new name in JVMLS11
+ * @since 3.15 BETA_JAVA11
+ */
+ int CONSTANT_DynamicCallSite = CONSTANT_InvokeDynamic;
+
/**
* @since 3.14
*/
@@ -53,6 +58,11 @@ public interface IConstantPoolConstant {
* @since 3.14
*/
int CONSTANT_Package = 20;
+ /**
+ * For the proposed section of JVMLS11 4.4.13 The CONSTANT_Dynamic_info Structure
+ * @since 3.15 BETA_JAVA11
+ */
+ int CONSTANT_Dynamic = 17;
int CONSTANT_Methodref_SIZE = 5;
int CONSTANT_Class_SIZE = 3;
@@ -79,6 +89,10 @@ public interface IConstantPoolConstant {
int CONSTANT_InvokeDynamic_SIZE = 5;
/**
+ * @since 3.15 BETA_JAVA11
+ */
+ int CONSTANT_Dynamic_SIZE = 5;
+ /**
* @since 3.14
*/
int CONSTANT_Module_SIZE = 3;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java
index e38aa0a491..c1529c8cec 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -68,6 +68,7 @@ public interface IConstantPoolEntry {
* @see IConstantPoolConstant#CONSTANT_Methodref
* @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
* @see IConstantPoolConstant#CONSTANT_InvokeDynamic
+ * @see IConstantPoolConstant#CONSTANT_Dynamic
*/
int getNameAndTypeIndex();
@@ -184,6 +185,7 @@ public interface IConstantPoolEntry {
* @see IConstantPoolConstant#CONSTANT_Methodref
* @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
* @see IConstantPoolConstant#CONSTANT_InvokeDynamic
+ * @see IConstantPoolConstant#CONSTANT_Dynamic
*/
char[] getMethodName();
@@ -215,6 +217,7 @@ public interface IConstantPoolEntry {
* @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
* @see IConstantPoolConstant#CONSTANT_MethodType
* @see IConstantPoolConstant#CONSTANT_InvokeDynamic
+ * @see IConstantPoolConstant#CONSTANT_Dynamic
*/
char[] getMethodDescriptor();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java
index 29ee75dc02..88c6570c5f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,6 +57,7 @@ public interface IConstantPoolEntry2 extends IConstantPoolEntry {
*
* @return the reference kind. This value is set only when decoding a MethodHandle entry.
* @see IConstantPoolConstant#CONSTANT_InvokeDynamic
+ * @see IConstantPoolConstant#CONSTANT_Dynamic
*/
int getBootstrapMethodAttributeIndex();
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestHostAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestHostAttribute.java
new file mode 100644
index 0000000000..878fbe0f10
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestHostAttribute.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of a nest host attribute as described in the JVM
+ * specifications.
+ * @since 3.15 BETA_JAVA11
+ */
+public interface INestHostAttribute {
+ /**
+ * Answer back the class name as specified
+ * in the JVM specifications.
+ *
+ * @return the class name as specified
+ * in the JVM specifications
+ */
+ char[] getNestHostName();
+
+ /**
+ * Answer back the class name index.
+ *
+ * @return the class name index
+ */
+ int getNestHostIndex();
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMemberAttributeEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMemberAttributeEntry.java
new file mode 100644
index 0000000000..7d986fb837
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMemberAttributeEntry.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of a nest host attribute as described in the JVM
+ * specifications.
+ * @since 3.15 BETA_JAVA11
+ */
+public interface INestMemberAttributeEntry {
+
+ /**
+ * Answer back the nest member name as specified
+ * in the JVM specifications.
+ *
+ * @return the nest member name as specified
+ * in the JVM specifications
+ */
+ char[] getNestMemberName();
+
+ /**
+ * Answer back the nest member name index.
+ *
+ * @return the nest memeber name index
+ */
+ int getNestMemberIndex();
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMembersAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMembersAttribute.java
new file mode 100644
index 0000000000..bf952ad6c8
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMembersAttribute.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of nest members attribute as described in the JVM
+ * specifications.
+ *
+ * @since 3.15 BETA_JAVA11
+ */
+public interface INestMembersAttribute extends IClassFileAttribute {
+
+ /**
+ * Answer back the number of nest members as specified in
+ * the JVM specifications.
+ *
+ * @return the number of nest members as specified in
+ * the JVM specifications
+ */
+ int getNumberOfNestMembers();
+
+ /**
+ * Answer back the array of nest member attribute entries as specified in
+ * the JVM specifications, or an empty array if none.
+ *
+ * @return the array of nest member attribute entries as specified in
+ * the JVM specifications, or an empty array if none
+ */
+ INestMemberAttributeEntry[] getNestMemberAttributesEntries();
+}
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 ca2d2da8a2..a55bb957e4 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.JLS10);
+ this.parser = ASTParser.newParser(AST.JLS11);
}
/**
* 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 acf58b0475..02de1a2244 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
@@ -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.JLS10);
+ ASTParser parser = ASTParser.newParser(AST.JLS11);
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 b8ee1d7620..40b2454030 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
@@ -83,7 +83,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.JLS10);
+ ASTParser parser = ASTParser.newParser(AST.JLS11);
parser.setSource(this.source.toCharArray());
parser.setProject(getCompilationUnit().getJavaProject());
parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
@@ -170,7 +170,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.JLS10);
+ ASTParser parser = ASTParser.newParser(AST.JLS11);
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 d2d4d6188e..78fc71d275 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
@@ -84,7 +84,7 @@ public class DeleteElementsOperation extends MultiOperation {
}
private void initASTParser() {
- this.parser = ASTParser.newParser(AST.JLS10);
+ this.parser = ASTParser.newParser(AST.JLS11);
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 822c754186..c8229eeaab 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -432,7 +432,7 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
public static class CompilationParticipants {
- private final static int MAX_SOURCE_LEVEL = 10 ; // 1.1 to 1.8 and 9, 10
+ private final static int MAX_SOURCE_LEVEL = 11 ; // 1.1 to 1.8 and 9, 10
/*
* The registered compilation participants (a table from int (source level) to Object[])
@@ -567,29 +567,11 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
private int indexForSourceLevel(String sourceLevel) {
if (sourceLevel == null) return 0;
int majVersion = (int) (CompilerOptions.versionToJdkLevel(sourceLevel) >>> 16);
- switch (majVersion) {
- case ClassFileConstants.MAJOR_VERSION_1_2:
- return 1;
- case ClassFileConstants.MAJOR_VERSION_1_3:
- return 2;
- case ClassFileConstants.MAJOR_VERSION_1_4:
- return 3;
- case ClassFileConstants.MAJOR_VERSION_1_5:
- return 4;
- case ClassFileConstants.MAJOR_VERSION_1_6:
- return 5;
- case ClassFileConstants.MAJOR_VERSION_1_7:
- return 6;
- case ClassFileConstants.MAJOR_VERSION_1_8:
- return 7;
- case ClassFileConstants.MAJOR_VERSION_9:
- return 8;
- case ClassFileConstants.MAJOR_VERSION_10:
- return 9;
- default:
- // all other cases including ClassFileConstants.MAJOR_VERSION_1_1
- return 0;
+ if (majVersion > ClassFileConstants.MAJOR_VERSION_1_2) {
+ return (majVersion - ClassFileConstants.MAJOR_VERSION_1_1);
}
+ // all other cases including ClassFileConstants.MAJOR_VERSION_1_1
+ return 0;
}
private int sortParticipants(ArrayList<IConfigurationElement> group, IConfigurationElement[] configElements, int index) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java
index 811a2c698d..34ab941c95 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java
@@ -179,7 +179,7 @@ public void initialize() {
return;
}
this.release = getReleaseOptionFromCompliance(this.release);
- this.releaseInHex = Integer.toHexString(Integer.parseInt(this.release));
+ this.releaseInHex = Integer.toHexString(Integer.parseInt(this.release)).toUpperCase();
Path lib = Paths.get(this.zipFilename).getParent();
Path filePath = Paths.get(lib.toString(), "ct.sym"); //$NON-NLS-1$
URI t = filePath.toUri();
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 8c533b759e..f75bdf49f3 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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.core.util.IFieldInfo;
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.ISourceAttribute;
import org.eclipse.jdt.internal.compiler.util.Util;
@@ -46,6 +47,7 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
private IFieldInfo[] fields;
private int fieldsCount;
private IInnerClassesAttribute innerClassesAttribute;
+ private INestMembersAttribute nestMembersAttribute;
private int[] interfaceIndexes;
private char[][] interfaceNames;
private int interfacesCount;
@@ -157,6 +159,10 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
constantPoolOffsets[i] = readOffset;
readOffset += IConstantPoolConstant.CONSTANT_InvokeDynamic_SIZE;
break;
+ case IConstantPoolConstant.CONSTANT_Dynamic :
+ constantPoolOffsets[i] = readOffset;
+ readOffset += IConstantPoolConstant.CONSTANT_Dynamic_SIZE;
+ break;
case IConstantPoolConstant.CONSTANT_Module:
constantPoolOffsets[i] = readOffset;
readOffset += IConstantPoolConstant.CONSTANT_Module_SIZE;
@@ -298,10 +304,16 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
this.attributes[attributesIndex++] = new ModulePackagesAttribute(classFileBytes, this.constantPool, readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.MODULE_MAIN_CLASS)) {
this.attributes[attributesIndex++] = new ModuleMainClassAttribute(classFileBytes, this.constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.NEST_HOST)) {
+ this.attributes[attributesIndex++] = new NestHostAttribute(classFileBytes, this.constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.NEST_MEMBERS)) {
+ this.nestMembersAttribute = new NestMembersAttribute(classFileBytes, this.constantPool, readOffset);
+ this.attributes[attributesIndex++] = this.nestMembersAttribute;
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
}
- readOffset += (6 + u4At(classFileBytes, readOffset + 2, 0));
+ long tmp = u4At(classFileBytes, readOffset + 2, 0);
+ readOffset += (6 + tmp);
}
} else {
for (int i = 0; i < this.attributesCount; i++) {
@@ -395,6 +407,11 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
return this.innerClassesAttribute;
}
+ @Override
+ public INestMembersAttribute getNestMembersAttribute() {
+ return this.nestMembersAttribute;
+ }
+
/**
* @see IClassFileReader#getInterfaceIndexes()
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
index 69928ca1a5..e6a980c085 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
@@ -270,28 +270,14 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
case IOpcodeMnemonics.LDC :
index = u1At(this.classFileBytes, 1, pc);
constantPoolEntry = this.constantPool.decodeEntry(index);
- if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Float
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Integer
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_String
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_MethodType
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_MethodHandle) {
- throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
- }
+ checkConstantAndThrow(constantPoolEntry.getKind());
visitor._ldc(pc - this.codeOffset, index, constantPoolEntry);
pc+=2;
break;
case IOpcodeMnemonics.LDC_W :
index = u2At(this.classFileBytes, 1, pc);
constantPoolEntry = this.constantPool.decodeEntry(index);
- if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Float
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Integer
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_String
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_MethodType
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_MethodHandle) {
- throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
- }
+ checkConstantAndThrow(constantPoolEntry.getKind());
visitor._ldc_w(pc - this.codeOffset, index, constantPoolEntry);
pc+=3;
break;
@@ -1204,4 +1190,9 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
}
}
}
+ private void checkConstantAndThrow(int kind) throws ClassFormatException {
+ if (kind == IConstantPoolConstant.CONSTANT_Long || kind == IConstantPoolConstant.CONSTANT_Double) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ }
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java
index 858cf7ae27..6e8a244acf 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -155,6 +155,19 @@ public class ConstantPool extends ClassFileStruct implements IConstantPool {
constantPoolEntry2.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
constantPoolEntry = constantPoolEntry2;
break;
+ case IConstantPoolConstant.CONSTANT_Dynamic :
+ constantPoolEntry2 = new ConstantPoolEntry2();
+ constantPoolEntry2.reset();
+ constantPoolEntry2.setKind(kind);
+ constantPoolEntry2.setBootstrapMethodAttributeIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
+ int nameAndTypeIndex2 = u2At(this.classFileBytes, 3, this.constantPoolOffset[index]);
+ constantPoolEntry2.setNameAndTypeIndex(nameAndTypeIndex2);
+ fieldNameIndex = u2At(this.classFileBytes, 1, this.constantPoolOffset[nameAndTypeIndex2]);
+ fieldDescriptorIndex = u2At(this.classFileBytes, 3, this.constantPoolOffset[nameAndTypeIndex2]);
+ constantPoolEntry2.setFieldName(getUtf8ValueAt(fieldNameIndex));
+ constantPoolEntry2.setFieldDescriptor(getUtf8ValueAt(fieldDescriptorIndex));
+ constantPoolEntry = constantPoolEntry2;
+ break;
case IConstantPoolConstant.CONSTANT_Module :
constantPoolEntry2 = new ConstantPoolEntry2();
constantPoolEntry2.reset();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java
index 3bb41e033f..f8ff04aca9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java
@@ -2099,6 +2099,10 @@ public class DefaultBytecodeVisitor implements IBytecodeVisitor {
appendConstantMethodHandle(this.buffer, Messages.classformat_ldc_w_methodhandle,
IOpcodeMnemonics.LDC, index, constantPoolEntry);
break;
+ case IConstantPoolConstant.CONSTANT_Dynamic :
+ appendConstantDynamic(this.buffer, Messages.classformat_ldc_w_dynamic,
+ IOpcodeMnemonics.LDC, index, constantPoolEntry);
+ break;
}
writeNewLine();
}
@@ -2121,6 +2125,16 @@ public class DefaultBytecodeVisitor implements IBytecodeVisitor {
Integer.toString(((IConstantPoolEntry2) constantPoolEntry).getReferenceIndex())
}));
}
+ private StringBuffer appendConstantDynamic(StringBuffer s, String messageKind, int opcode,
+ int index, IConstantPoolEntry entry) {
+ return s.append(Messages.bind(messageKind, new String[] {
+ OpcodeStringValues.BYTECODE_NAMES[opcode],
+ Integer.toString(index),
+ Integer.toString(((IConstantPoolEntry2) entry).getBootstrapMethodAttributeIndex()),
+ new String(entry.getFieldName()),
+ returnClassName(Signature.toCharArray(entry.getFieldDescriptor()))
+ }));
+ }
/**
* @see IBytecodeVisitor#_ldc2_w(int, int, IConstantPoolEntry)
*/
@@ -2141,6 +2155,19 @@ public class DefaultBytecodeVisitor implements IBytecodeVisitor {
Integer.toString(index),
Double.toString(constantPoolEntry.getDoubleValue())
}));
+ break;
+ case IConstantPoolConstant.CONSTANT_MethodType :
+ appendConstantMethodType(this.buffer, Messages.classformat_ldc_w_methodhandle,
+ IOpcodeMnemonics.LDC2_W, index, constantPoolEntry);
+ break;
+ case IConstantPoolConstant.CONSTANT_MethodHandle :
+ appendConstantMethodHandle(this.buffer, Messages.classformat_ldc_w_methodhandle,
+ IOpcodeMnemonics.LDC2_W, index, constantPoolEntry);
+ break;
+ case IConstantPoolConstant.CONSTANT_Dynamic :
+ appendConstantDynamic(this.buffer, Messages.classformat_ldc_w_dynamic,
+ IOpcodeMnemonics.LDC2_W, index, constantPoolEntry);
+ break;
}
writeNewLine();
}
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 ed9f7edc1b..8956c7928d 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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.jdt.core.Signature;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.util.*;
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
/**
@@ -989,24 +990,10 @@ public class Disassembler extends ClassFileBytesDisassembler {
String versionNumber = VERSION_UNKNOWN;
if (minorVersion == 3 && majorVersion == 45) {
versionNumber = JavaCore.VERSION_1_1;
- } else if (minorVersion == 0 && majorVersion == 46) {
- versionNumber = JavaCore.VERSION_1_2;
- } else if (minorVersion == 0 && majorVersion == 47) {
- versionNumber = JavaCore.VERSION_1_3;
- } else if (minorVersion == 0 && majorVersion == 48) {
- versionNumber = JavaCore.VERSION_1_4;
- } else if (minorVersion == 0 && majorVersion == 49) {
- versionNumber = JavaCore.VERSION_1_5;
- } else if (minorVersion == 0 && majorVersion == 50) {
- versionNumber = JavaCore.VERSION_1_6;
- } else if (minorVersion == 0 && majorVersion == 51) {
- versionNumber = JavaCore.VERSION_1_7;
- } else if (minorVersion == 0 && majorVersion == 52) {
- versionNumber = JavaCore.VERSION_1_8;
- } else if (minorVersion == 0 && majorVersion == 53) {
- versionNumber = JavaCore.VERSION_9;
- } else if (minorVersion == 0 && majorVersion == 54) {
- versionNumber = JavaCore.VERSION_10;
+ } else {
+ versionNumber = CompilerOptions.versionFromJdkLevel((majorVersion << 16) + minorVersion);
+ if (versionNumber.length() == 0)
+ versionNumber = VERSION_UNKNOWN;
}
buffer.append(
Messages.bind(Messages.classfileformat_versiondetails,
@@ -1035,6 +1022,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
writeNewLine(buffer, lineSeparator, 0);
}
+ INestMembersAttribute nestMembersAttribute = classFileReader.getNestMembersAttribute();
IInnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute();
IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
@@ -1164,6 +1152,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
IClassFileAttribute[] attributes = classFileReader.getAttributes();
int length = attributes.length;
IEnclosingMethodAttribute enclosingMethodAttribute = (IEnclosingMethodAttribute) Util.getAttribute(classFileReader, IAttributeNamesConstants.ENCLOSING_METHOD);
+ INestHostAttribute nestHostAttribute = (INestHostAttribute) Util.getAttribute(classFileReader, IAttributeNamesConstants.NEST_HOST);
int remainingAttributesLength = length;
if (innerClassesAttribute != null) {
remainingAttributesLength--;
@@ -1183,8 +1172,16 @@ public class Disassembler extends ClassFileBytesDisassembler {
if (moduleAttribute != null) {
remainingAttributesLength--;
}
+ if (nestHostAttribute != null) {
+ remainingAttributesLength--;
+ }
+ if (nestMembersAttribute != null) {
+ remainingAttributesLength--;
+ }
if (innerClassesAttribute != null
|| enclosingMethodAttribute != null
+ || nestHostAttribute != null
+ || nestMembersAttribute != null
|| bootstrapMethods != null
|| moduleAttribute != null
|| remainingAttributesLength != 0) {
@@ -1199,6 +1196,12 @@ public class Disassembler extends ClassFileBytesDisassembler {
if (enclosingMethodAttribute != null) {
disassemble(enclosingMethodAttribute, buffer, lineSeparator, 0);
}
+ if (nestHostAttribute != null) {
+ disassemble(nestHostAttribute, buffer, lineSeparator, 0);
+ }
+ if (nestMembersAttribute != null) {
+ disassemble(nestMembersAttribute, buffer, lineSeparator, 0);
+ }
if (bootstrapMethods != null) {
disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
}
@@ -1219,6 +1222,8 @@ public class Disassembler extends ClassFileBytesDisassembler {
for (int i = 0; i < length; i++) {
IClassFileAttribute attribute = attributes[i];
if (attribute != innerClassesAttribute
+ && attribute != nestHostAttribute
+ && attribute != nestMembersAttribute
&& attribute != sourceAttribute
&& attribute != signatureAttribute
&& attribute != enclosingMethodAttribute
@@ -1337,6 +1342,43 @@ public class Disassembler extends ClassFileBytesDisassembler {
buffer.append(';');
}
+ private void disassemble(INestHostAttribute nestHostAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
+ writeNewLine(buffer, lineSeparator, tabNumber);
+ writeNewLine(buffer, lineSeparator, tabNumber); // additional line
+ buffer.append(Messages.disassembler_nesthost);
+ buffer
+ .append(Messages.disassembler_constantpoolindex)
+ .append(nestHostAttribute.getNestHostIndex())
+ .append(" ")//$NON-NLS-1$
+ .append(nestHostAttribute.getNestHostName());
+ }
+
+ private void disassemble(INestMembersAttribute nestMembersAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
+ writeNewLine(buffer, lineSeparator, tabNumber);
+ writeNewLine(buffer, lineSeparator, tabNumber); // additional line
+ buffer.append(Messages.disassembler_nestmembers);
+ writeNewLine(buffer, lineSeparator, tabNumber + 1);
+ INestMemberAttributeEntry[] entries = nestMembersAttribute.getNestMemberAttributesEntries();
+ int length = entries.length;
+ int nestMemberIndex;
+ INestMemberAttributeEntry entry;
+ for (int i = 0; i < length; i++) {
+ if (i != 0) {
+ buffer.append(Messages.disassembler_comma);
+ writeNewLine(buffer, lineSeparator, tabNumber + 1);
+ }
+ entry = entries[i];
+ nestMemberIndex = entry.getNestMemberIndex();
+ buffer
+ .append(Messages.disassembler_constantpoolindex)
+ .append(nestMemberIndex);
+ if (nestMemberIndex != 0) {
+ buffer
+ .append(Messages.disassembler_space)
+ .append(entry.getNestMemberName());
+ }
+ }
+ }
private void disassemble(IPackageVisibilityInfo iPackageVisibilityInfo, StringBuffer buffer, String lineSeparator,
int tabNumber, boolean isExports) {
buffer.append(isExports ? "exports" : "opens"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1796,7 +1838,8 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(i);
String[] methodDescription;
- switch (constantPool.getEntryKind(i)) {
+ int kind = constantPool.getEntryKind(i);
+ switch (kind) {
case IConstantPoolConstant.CONSTANT_Class :
buffer.append(
Messages.bind(Messages.disassembler_constantpool_class,
@@ -1927,6 +1970,19 @@ public class Disassembler extends ClassFileBytesDisassembler {
new String(constantPoolEntry.getMethodName()),
new String(constantPoolEntry.getMethodDescriptor())
}));
+ break;
+ case IConstantPoolConstant.CONSTANT_Dynamic :
+ entry2 = (IConstantPoolEntry2) constantPoolEntry;
+ buffer.append(
+ Messages.bind(Messages.disassembler_constantpool_dynamic,
+ new String[] {
+ Integer.toString(i),
+ Integer.toString(entry2.getBootstrapMethodAttributeIndex()),
+ Integer.toString(entry2.getNameAndTypeIndex()),
+ new String(constantPoolEntry.getFieldName()),
+ new String(constantPoolEntry.getFieldDescriptor())
+ }));
+ break;
}
}
}
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 00784ea500..82e9c02430 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
@@ -277,6 +277,8 @@ public final class Messages extends NLS {
public static String disassembler_outer_class_info_name;
public static String disassembler_inner_name;
public static String disassembler_inner_accessflags;
+ public static String disassembler_nesthost;
+ public static String disassembler_nestmembers;
public static String disassembler_genericattributeheader;
public static String disassembler_signatureattributeheader;
public static String disassembler_bootstrapmethodattributesheader;
@@ -304,6 +306,7 @@ public final class Messages extends NLS {
public static String disassembler_constantpool_methodhandle;
public static String disassembler_constantpool_methodtype;
public static String disassembler_constantpool_invokedynamic;
+ public static String disassembler_constantpool_dynamic;
public static String disassembler_annotationdefaultheader;
public static String disassembler_annotationdefaultvalue;
public static String disassembler_annotationenumvalue;
@@ -365,6 +368,7 @@ public final class Messages extends NLS {
public static String classformat_ldc_w_class;
public static String classformat_ldc_w_methodtype;
public static String classformat_ldc_w_methodhandle;
+ public static String classformat_ldc_w_dynamic;
public static String classformat_ldc_w_float;
public static String classformat_ldc_w_integer;
public static String classformat_ldc_w_string;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java
new file mode 100644
index 0000000000..864b0e9743
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * 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.INestHostAttribute;
+
+public class NestHostAttribute extends ClassFileAttribute implements INestHostAttribute {
+
+ private int hostIndex;
+ private char[] hostName;
+
+ public NestHostAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ int index = u2At(classFileBytes, 6, offset);
+ this.hostIndex = index;
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.hostName = constantPoolEntry.getClassInfoName();
+ }
+
+ @Override
+ public char[] getNestHostName() {
+ return this.hostName;
+ }
+
+ @Override
+ public int getNestHostIndex() {
+ return this.hostIndex;
+ }
+ @Override
+ public String toString() {
+ return new String(this.hostName);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java
new file mode 100644
index 0000000000..020187c6a6
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * 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.INestMemberAttributeEntry;
+import org.eclipse.jdt.core.util.INestMembersAttribute;
+
+/**
+ * Default implementation of INestMembersAttribute.
+ */
+public class NestMembersAttribute extends ClassFileAttribute implements INestMembersAttribute {
+ private static final INestMemberAttributeEntry[] NO_ENTRIES = new INestMemberAttributeEntry[0];
+
+ private int nestMembers;
+ private INestMemberAttributeEntry[] entries;
+
+ /**
+ * Constructor for NestMembersAttribute.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public NestMembersAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ this.nestMembers = u2At(classFileBytes, 6, offset);
+ final int length = this.nestMembers;
+ if (length != 0) {
+ int readOffset = 8;
+ this.entries = new INestMemberAttributeEntry[length];
+ for (int i = 0; i < length; i++) {
+ this.entries[i] = new NestMembersAttributeEntry(classFileBytes, constantPool, offset + readOffset);
+ readOffset += 2;
+ }
+ } else {
+ this.entries = NO_ENTRIES;
+ }
+ }
+
+ @Override
+ public int getNumberOfNestMembers() {
+ return this.nestMembers;
+ }
+
+ @Override
+ public INestMemberAttributeEntry[] getNestMemberAttributesEntries() {
+ return this.entries;
+ }
+
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java
new file mode 100644
index 0000000000..5456c78f8c
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * 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.INestMemberAttributeEntry;
+
+public class NestMembersAttributeEntry extends ClassFileStruct implements INestMemberAttributeEntry {
+
+ private int memberClassNameIndex;
+ private char[] memberClassName;
+
+ public NestMembersAttributeEntry(byte[] classFileBytes, IConstantPool constantPool, int offset)
+ throws ClassFormatException {
+ this.memberClassNameIndex = u2At(classFileBytes, 0, offset);
+ if (this.memberClassNameIndex != 0) {
+ IConstantPoolEntry constantPoolEntry;
+ constantPoolEntry = constantPool.decodeEntry(this.memberClassNameIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.memberClassName = constantPoolEntry.getClassInfoName();
+ }
+ }
+
+ @Override
+ public char[] getNestMemberName() {
+ return this.memberClassName;
+ }
+
+ @Override
+ public int getNestMemberIndex() {
+ return this.memberClassNameIndex;
+ }
+
+ @Override
+ public String toString() {
+ return new String(this.memberClassName);
+ }
+}
+
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 7c64d8498f..7d00a513bd 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
@@ -297,6 +297,8 @@ disassembler_methodparametersheader = Method Parameters:
disassembler_localvariabletableattributeheader = Local variable table:
disassembler_localvariabletypetableattributeheader = Local variable type table:
disassembler_arraydimensions = []
+disassembler_nesthost = Nest Host:
+disassembler_nestmembers = Nest Members:
disassembler_innerattributesheader = Inner classes:
disassembler_inner_class_info_name = inner class info:
disassembler_outer_class_info_name = outer class info:
@@ -331,6 +333,7 @@ disassembler_constantpool_utf8 = constant #{0} utf8: "{1}"
disassembler_constantpool_methodhandle = constant #{0} method handle: {1} #{2}
disassembler_constantpool_methodtype = constant #{0} method type: #{1} {2}
disassembler_constantpool_invokedynamic = constant #{0} invoke dynamic: #{1} #{2} {3} {4}
+disassembler_constantpool_dynamic = constant #{0} dynamic: #{1} #{2} {3} {4}
disassembler_annotationdefaultheader = Annotation Default:\
disassembler_annotationdefaultvalue= {0} (constant type)
disassembler_annotationenumvalue = {2}.{3}(enum type #{0}.#{1})
@@ -414,6 +417,7 @@ classformat_checkcast = {0} {2} [{1}]
classformat_instanceof = {0} {2} [{1}]
classformat_ldc_w_methodtype = {0} <MethodType {2}> [{1}]
classformat_ldc_w_methodhandle = {0} <MethodHandle {2} {3}> [{1}]
+classformat_ldc_w_dynamic = {0} <Dynamic> {2} {3} {4} [{1}]
classformat_ldc_w_class = {0} <Class {2}> [{1}]
classformat_ldc_w_float = {0} <Float {2}> [{1}]
classformat_ldc_w_integer = {0} <Integer {2}> [{1}]
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index b94b5d8673..f9a2bc1202 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.15.0-SNAPSHOT</version>
+ <version>3.15.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>

Back to the top