Update jdt.core to S4_14_0_RC2
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java
index f29622f..ddfaa7a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaIndexTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2012, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,6 +16,9 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.zip.CRC32;
import junit.framework.Test;
@@ -34,6 +37,7 @@
import org.eclipse.jdt.core.index.*;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.core.ClasspathEntry;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.UserLibraryClasspathContainer;
import org.osgi.service.prefs.BackingStoreException;
@@ -50,6 +54,7 @@
public static Test suite() {
return buildModelTestSuite(JavaIndexTests.class);
}
+
// Test that the index file is really generated.
public void testGenerateIndex() throws IOException {
String indexFilePath = getExternalResourcePath("Test.index");
@@ -866,4 +871,56 @@
deleteProject("ForIndex");
}
}
+
+ // Test shared index location functionality
+ public void testSharedIndexLocation() throws CoreException, IOException {
+ // Create temporary testing folder
+ String sharedIndexDir = Files.createTempDirectory("shared_index").toFile().getCanonicalPath();
+ // enable shared index
+ ClasspathEntry.setSharedIndexLocation(sharedIndexDir, getClass());
+ // path of library must be platform neutral
+ String jarFilePath = Path.fromOSString(Paths.get(sharedIndexDir, "Test.jar").toString()).toPortableString();
+ // compute index file
+ CRC32 checksumCalculator = new CRC32();
+ checksumCalculator.update(jarFilePath.getBytes());
+ String fileName = Long.toString(checksumCalculator.getValue()) + ".index";
+ String indexFilePath = Paths.get(sharedIndexDir, fileName).toString();
+ try {
+ createJar(new String[] {
+ "pkg/Test.java",
+ "package pkg;\n" +
+ "public class Test {\n" +
+ " protected Test(int i) {}\n" +
+ "}"}, jarFilePath);
+
+ JavaIndexer.generateIndexForJar(jarFilePath, indexFilePath);
+ assertTrue(new File(indexFilePath).exists());
+ long modified = new File(indexFilePath).lastModified();
+
+ IJavaProject p = createJavaProject("P");
+ Path libPath = new Path(jarFilePath);
+ IClasspathEntry entry = JavaCore.newLibraryEntry(libPath, null, null, null, null, false);
+ setClasspath(p, new IClasspathEntry[] { entry });
+
+ waitUntilIndexesReady();
+
+ // Test that search works properly
+ search("Test", TYPE, DECLARATIONS, EXACT_RULE,
+ SearchEngine.createJavaSearchScope(new IJavaElement[] { p }));
+ assertSearchResults(Paths.get(sharedIndexDir, "Test.jar").toString() + " pkg.Test");
+
+ // Test that specified index file is really used
+ java.io.File indexFile = JavaModelManager.getIndexManager().getIndex(libPath, false, false).getIndexFile();
+ assertEquals("Specified index file is not being used", indexFilePath, indexFile.toString());
+
+ // Ensure that the index file is not modified
+ assertEquals(modified, new File(indexFilePath).lastModified());
+ } finally {
+ deleteProject("P");
+ new File(indexFilePath).delete();
+ new File(jarFilePath).delete();
+ new File(sharedIndexDir).delete();
+ ClasspathEntry.setSharedIndexLocation(null, getClass());
+ }
+ }
}
diff --git a/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs
index 2ec8851..6f7536a 100644
--- a/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs
+++ b/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs
@@ -1,104 +1,94 @@
-ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Ignore
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Ignore
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Ignore
-API_USE_SCAN_FIELD_SEVERITY=Ignore
-API_USE_SCAN_METHOD_SEVERITY=Ignore
-API_USE_SCAN_TYPE_SEVERITY=Ignore
-CLASS_ELEMENT_TYPE_ADDED_FIELD=Ignore
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Ignore
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Ignore
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Ignore
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Ignore
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Ignore
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Ignore
-ILLEGAL_EXTEND=Ignore
-ILLEGAL_IMPLEMENT=Ignore
-ILLEGAL_INSTANTIATE=Ignore
-ILLEGAL_OVERRIDE=Ignore
-ILLEGAL_REFERENCE=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Ignore
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-INVALID_ANNOTATION=Ignore
-INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
-LEAK_EXTEND=Ignore
-LEAK_FIELD_DECL=Ignore
-LEAK_IMPLEMENT=Ignore
-LEAK_METHOD_PARAM=Ignore
-LEAK_METHOD_RETURN_TYPE=Ignore
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Ignore
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Ignore
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Ignore
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Ignore
-UNUSED_PROBLEM_FILTERS=Ignore
-automatically_removed_unused_problem_filters=Ignore
-changed_execution_env=Ignore
+#Fri May 21 10:24:07 EDT 2010
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
eclipse.preferences.version=1
-incompatible_api_component_version=Ignore
+incompatible_api_component_version=Error
incompatible_api_component_version_include_major_without_breaking_change=Disabled
incompatible_api_component_version_include_minor_without_api_change=Disabled
-incompatible_api_component_version_report_major_without_breaking_change=Ignore
-incompatible_api_component_version_report_minor_without_api_change=Ignore
-invalid_since_tag_version=Ignore
-malformed_since_tag=Ignore
-missing_since_tag=Ignore
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Ignore
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
index c033178..2974407 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
@@ -469,7 +469,6 @@
}
updateDocComment();
} catch (Exception ex) {
- ex.printStackTrace();
validComment = false;
}
return validComment;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
index da6e0b7..065d667 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
@@ -1155,7 +1155,6 @@
}
protected boolean pushUsesReference(Object typeRef) {
- // TODO Auto-generated method stub
if (this.usesReferencesPtr == -1l) {
this.usesReferencesStack = new TypeReference[10];
}
@@ -1191,7 +1190,6 @@
}
protected boolean pushProvidesReference(Object typeRef) {
- // TODO Auto-generated method stub
if (this.providesReferencesPtr == -1l) {
this.providesReferencesStack = new TypeReference[10];
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index a7dbea6..37a4772 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -1914,7 +1914,7 @@
* @see #INDENT_BY_ONE
* @see #INDENT_DEFAULT
* @see #INDENT_ON_COLUMN
- * @since 3.19
+ * @since 3.20
*/
public static final String FORMATTER_TEXT_BLOCK_INDENTATION = JavaCore.PLUGIN_ID + ".formatter.text_block_indentation"; //$NON-NLS-1$
@@ -5103,7 +5103,7 @@
* <pre>
* FORMATTER / Indentation is not touched, it's preserved from original source.
* </pre>
- * @since 3.19
+ * @since 3.20
*/
public static final int INDENT_PRESERVE = 3;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
index 9479cd8..2ed3678 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
@@ -582,7 +582,7 @@
* @return a scanner
* @see org.eclipse.jdt.core.compiler.IScanner
*
- * @since 3.14
+ * @since 3.20
*/
@SuppressWarnings("javadoc") // references deprecated TokenNameIdentifier
public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator, String sourceLevel, String complianceLevel, boolean enablePreview) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index dc3de37..374d128 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -31,6 +31,7 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -38,6 +39,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.zip.CRC32;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -122,6 +124,9 @@
public static final String TAG_DISCOURAGED = "discouraged"; //$NON-NLS-1$
public static final String TAG_IGNORE_IF_BETTER = "ignoreifbetter"; //$NON-NLS-1$
+ // common index location for all workspaces
+ private static String SHARED_INDEX_LOCATION = System.getProperty("jdt.core.sharedIndexLocation"); //$NON-NLS-1$
+
/**
* Describes the kind of classpath entry - one of
* CPE_PROJECT, CPE_LIBRARY, CPE_SOURCE, CPE_VARIABLE or CPE_CONTAINER
@@ -1757,6 +1762,18 @@
public URL getLibraryIndexLocation() {
switch(getEntryKind()) {
case IClasspathEntry.CPE_LIBRARY :
+ if (SHARED_INDEX_LOCATION != null) {
+ try {
+ String pathString = getPath().toPortableString();
+ CRC32 checksumCalculator = new CRC32();
+ checksumCalculator.update(pathString.getBytes());
+ String fileName = Long.toString(checksumCalculator.getValue()) + ".index"; //$NON-NLS-1$
+ return new URL("file", null, Paths.get(SHARED_INDEX_LOCATION, fileName).toString()); //$NON-NLS-1$
+ } catch (MalformedURLException e1) {
+ Util.log(e1); // should not happen if protocol known (eg. 'file')
+ }
+ }
+ break;
case IClasspathEntry.CPE_VARIABLE :
break;
default :
@@ -2523,4 +2540,15 @@
}
return JavaModelStatus.VERIFIED_OK;
}
+
+ /*
+ * For testing shared index location in JavaIndexTests only
+ */
+ public static void setSharedIndexLocation(String value, Class<?> clazz) throws IllegalArgumentException{
+ if (clazz != null && "org.eclipse.jdt.core.tests.model.JavaIndexTests".equals(clazz.getName())) { //$NON-NLS-1$
+ SHARED_INDEX_LOCATION = value;
+ } else {
+ throw new IllegalArgumentException("Cannot set index location for specified test class"); //$NON-NLS-1$
+ }
+ }
}