From 362b8a1d67b06933194e2e17a7048c92498007dc Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 26 Nov 2019 16:25:03 +0000 Subject: Bug 553472 - NPE while resolving module javadoc - add check for ModuleDeclaration in getDeclarationModifiers() Change-Id: Ic1649e58d3f96860d34fed3f4707f5cbab12b053 --- .../compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java | 4 ++++ 1 file changed, 4 insertions(+) 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 b12939745a..0742835abe 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 @@ -2530,6 +2530,10 @@ public abstract class Scope { MethodScope methodScope = methodScope(); if (!methodScope.isInsideInitializer()){ // check method modifiers to see if deprecated + ReferenceContext ref = methodScope.referenceContext(); + if (ref instanceof ModuleDeclaration) { + return ((ModuleDeclaration)ref).modifiers; + } MethodBinding context = ((AbstractMethodDeclaration)methodScope.referenceContext).binding; if (context != null) return context.modifiers; -- cgit v1.2.3 From 904a3834c16ee0e04598dbfd063519023071e5bf Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 28 Nov 2019 14:53:40 +0000 Subject: Bug 553559 - illegalargumentexception on stdout or stderr - remove stack trace in AbstractCommentParser.commentParse() - remove stub comments in JavadocParser Change-Id: I0b6d92f9362280234fe5757fc07a9ac8285af66f --- .../org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java | 1 - .../org/eclipse/jdt/internal/compiler/parser/JavadocParser.java | 2 -- 2 files changed, 3 deletions(-) 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 9b90a4f978..24a2b3553c 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 @@ -465,7 +465,6 @@ public abstract class AbstractCommentParser implements JavadocTagConstants { } 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 0fe67daee5..8e845d4c72 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 @@ -1068,7 +1068,6 @@ public class JavadocParser extends AbstractCommentParser { } protected boolean pushUsesReference(Object typeRef) { - // TODO Auto-generated method stub if (this.usesReferencesPtr == -1l) { this.usesReferencesStack = new TypeReference[10]; } @@ -1104,7 +1103,6 @@ public class JavadocParser extends AbstractCommentParser { } protected boolean pushProvidesReference(Object typeRef) { - // TODO Auto-generated method stub if (this.providesReferencesPtr == -1l) { this.providesReferencesStack = new TypeReference[10]; } -- cgit v1.2.3 From deea9fcf7ccba05989e3c83f7a23150a0aa61920 Mon Sep 17 00:00:00 2001 From: Jay Arthanareeswaran Date: Tue, 5 Nov 2019 12:00:17 +0530 Subject: Bug 553315 - Revert the changes to the pde.api.tools preferences Change-Id: If07569b176bd5e4b1a33e4310453036cbf9a97d2 Signed-off-by: Jay Arthanareeswaran --- .../.settings/org.eclipse.pde.api.tools.prefs | 190 ++++++++++----------- .../formatter/DefaultCodeFormatterConstants.java | 4 +- .../model/org/eclipse/jdt/core/ToolFactory.java | 2 +- 3 files changed, 93 insertions(+), 103 deletions(-) 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 2ec8851f0c..6f7536aee1 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/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java index a7dbea666e..37a4772f4c 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 @@ public class DefaultCodeFormatterConstants { * @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 @@ public class DefaultCodeFormatterConstants { *
 	 * FORMATTER / Indentation is not touched, it's preserved from original source.
 	 * 
- * @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 9479cd8a34..2ed3678dcd 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 @@ public class ToolFactory { * @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) { -- cgit v1.2.3 From 9c0cf52f3525e62dc2c7dbd9ccbcf3edd9f8ab89 Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Thu, 24 Oct 2019 18:37:11 -0400 Subject: Bug 515268 - Shared JDT Index folder among different workspaces. - Allow enablement of this feature using jdt.core.sharedIndexLocation property - Index entries not present in the common location will still cause the index manager to fall back to creating the index in the normal workspace location Change-Id: I0a2d41a3abf23c64f98c8b3060c281dc71e48509 --- .../jdt/core/tests/model/JavaIndexTests.java | 59 +++++++++++++++++++++- .../eclipse/jdt/internal/core/ClasspathEntry.java | 30 ++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) 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 f29622ff8b..ddfaa7ac6e 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 @@ package org.eclipse.jdt.core.tests.model; 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.JavaCore; 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 class JavaIndexTests extends AbstractJavaSearchTests { 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 @@ public class JavaIndexTests extends AbstractJavaSearchTests { 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/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java index dc3de3704c..374d128034 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.OutputStreamWriter; 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.HashSet; 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 class ClasspathEntry implements IClasspathEntry { 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 class ClasspathEntry implements IClasspathEntry { 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 @@ public class ClasspathEntry implements IClasspathEntry { } 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$ + } + } } -- cgit v1.2.3 From 5db0d28d69c3e92cc9fd2bca1e43b9368d92c855 Mon Sep 17 00:00:00 2001 From: Niraj Modi Date: Fri, 6 Dec 2019 17:29:46 +0530 Subject: Bug 553742 - POM and product version change for 4.15 release Change-Id: Id05f77feef24e2ef3795cfbbd5b95d0f3724ca11 Signed-off-by: Niraj Modi --- org.eclipse.jdt.annotation/pom.xml | 2 +- org.eclipse.jdt.annotation_v1/pom.xml | 2 +- org.eclipse.jdt.apt.core/pom.xml | 2 +- org.eclipse.jdt.apt.pluggable.core/pom.xml | 2 +- org.eclipse.jdt.apt.pluggable.tests/pom.xml | 2 +- org.eclipse.jdt.apt.tests/pom.xml | 2 +- org.eclipse.jdt.apt.ui/pom.xml | 2 +- org.eclipse.jdt.compiler.apt.tests/pom.xml | 2 +- org.eclipse.jdt.compiler.apt/pom.xml | 2 +- org.eclipse.jdt.compiler.tool.tests/pom.xml | 2 +- org.eclipse.jdt.compiler.tool/pom.xml | 2 +- org.eclipse.jdt.core.tests.builder/pom.xml | 2 +- org.eclipse.jdt.core.tests.compiler/pom.xml | 2 +- org.eclipse.jdt.core.tests.model/pom.xml | 2 +- org.eclipse.jdt.core.tests.performance/pom.xml | 2 +- org.eclipse.jdt.core/pom.xml | 2 +- pom.xml | 4 ++-- tests-pom/pom.xml | 4 ++-- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/org.eclipse.jdt.annotation/pom.xml b/org.eclipse.jdt.annotation/pom.xml index c9369c5cdf..5b30b436b0 100644 --- a/org.eclipse.jdt.annotation/pom.xml +++ b/org.eclipse.jdt.annotation/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.annotation diff --git a/org.eclipse.jdt.annotation_v1/pom.xml b/org.eclipse.jdt.annotation_v1/pom.xml index c14801d46f..414920f360 100644 --- a/org.eclipse.jdt.annotation_v1/pom.xml +++ b/org.eclipse.jdt.annotation_v1/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.annotation diff --git a/org.eclipse.jdt.apt.core/pom.xml b/org.eclipse.jdt.apt.core/pom.xml index d6b10df7cc..5845a8a3c2 100644 --- a/org.eclipse.jdt.apt.core/pom.xml +++ b/org.eclipse.jdt.apt.core/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.apt.core diff --git a/org.eclipse.jdt.apt.pluggable.core/pom.xml b/org.eclipse.jdt.apt.pluggable.core/pom.xml index c4be2dc26a..48d832677a 100644 --- a/org.eclipse.jdt.apt.pluggable.core/pom.xml +++ b/org.eclipse.jdt.apt.pluggable.core/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.apt.pluggable.core diff --git a/org.eclipse.jdt.apt.pluggable.tests/pom.xml b/org.eclipse.jdt.apt.pluggable.tests/pom.xml index 4090363dc7..e171355314 100644 --- a/org.eclipse.jdt.apt.pluggable.tests/pom.xml +++ b/org.eclipse.jdt.apt.pluggable.tests/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.apt.tests/pom.xml b/org.eclipse.jdt.apt.tests/pom.xml index 9ec0feeed9..9bd697acfc 100644 --- a/org.eclipse.jdt.apt.tests/pom.xml +++ b/org.eclipse.jdt.apt.tests/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.apt.ui/pom.xml b/org.eclipse.jdt.apt.ui/pom.xml index 822d39d9d3..089dcc809f 100644 --- a/org.eclipse.jdt.apt.ui/pom.xml +++ b/org.eclipse.jdt.apt.ui/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.apt.ui diff --git a/org.eclipse.jdt.compiler.apt.tests/pom.xml b/org.eclipse.jdt.compiler.apt.tests/pom.xml index 69a0d98e46..1a7eac66a9 100644 --- a/org.eclipse.jdt.compiler.apt.tests/pom.xml +++ b/org.eclipse.jdt.compiler.apt.tests/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.compiler.apt/pom.xml b/org.eclipse.jdt.compiler.apt/pom.xml index 26133e0856..95fb78f28e 100644 --- a/org.eclipse.jdt.compiler.apt/pom.xml +++ b/org.eclipse.jdt.compiler.apt/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.compiler.apt diff --git a/org.eclipse.jdt.compiler.tool.tests/pom.xml b/org.eclipse.jdt.compiler.tool.tests/pom.xml index 6960622abb..91d3f635ad 100644 --- a/org.eclipse.jdt.compiler.tool.tests/pom.xml +++ b/org.eclipse.jdt.compiler.tool.tests/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.compiler.tool/pom.xml b/org.eclipse.jdt.compiler.tool/pom.xml index 29632bfb9a..9e591bec92 100644 --- a/org.eclipse.jdt.compiler.tool/pom.xml +++ b/org.eclipse.jdt.compiler.tool/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.compiler.tool diff --git a/org.eclipse.jdt.core.tests.builder/pom.xml b/org.eclipse.jdt.core.tests.builder/pom.xml index e6d81e716a..ab2977f7d3 100644 --- a/org.eclipse.jdt.core.tests.builder/pom.xml +++ b/org.eclipse.jdt.core.tests.builder/pom.xml @@ -14,7 +14,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml index f3fd207c78..a674c791e3 100644 --- a/org.eclipse.jdt.core.tests.compiler/pom.xml +++ b/org.eclipse.jdt.core.tests.compiler/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml index 908e76d739..1882153b64 100644 --- a/org.eclipse.jdt.core.tests.model/pom.xml +++ b/org.eclipse.jdt.core.tests.model/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.core.tests.performance/pom.xml b/org.eclipse.jdt.core.tests.performance/pom.xml index 1aa7656e5f..c7fcb3d952 100644 --- a/org.eclipse.jdt.core.tests.performance/pom.xml +++ b/org.eclipse.jdt.core.tests.performance/pom.xml @@ -15,7 +15,7 @@ tests-pom eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../tests-pom/ org.eclipse.jdt diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml index c2ce2e61d9..072033f2fb 100644 --- a/org.eclipse.jdt.core/pom.xml +++ b/org.eclipse.jdt.core/pom.xml @@ -14,7 +14,7 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT org.eclipse.jdt org.eclipse.jdt.core diff --git a/pom.xml b/pom.xml index bd8b151659..c624d18217 100644 --- a/pom.xml +++ b/pom.xml @@ -15,13 +15,13 @@ org.eclipse eclipse-platform-parent - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT ../eclipse-platform-parent eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT pom diff --git a/tests-pom/pom.xml b/tests-pom/pom.xml index f4da735a73..56f2e25c3b 100644 --- a/tests-pom/pom.xml +++ b/tests-pom/pom.xml @@ -14,10 +14,10 @@ eclipse.jdt.core eclipse.jdt.core - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT tests-pom - 4.14.0-SNAPSHOT + 4.15.0-SNAPSHOT pom ${tests.ignoredWarnings} -- cgit v1.2.3 From 5255d6d0ba1ee74633a638e1aa2cf4d5175d5dc2 Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Tue, 10 Dec 2019 22:37:17 +0100 Subject: Bug 534223 - Getting "Inconsistent classfile encountered: The undefined type parameter K is referenced " Also: - update of service versions - remove unused API filters - resolve warnings in o.e.j.core.tests.compiler Change-Id: If9930422a5914308ce789684b013f3b2264b4a80 --- .../META-INF/MANIFEST.MF | 2 +- org.eclipse.jdt.core.tests.compiler/pom.xml | 2 +- .../tests/compiler/regression/GenericTypeTest.java | 2 +- .../regression/GenericsRegressionTest_1_8.java | 35 +++++++ org.eclipse.jdt.core/.settings/.api_filters | 106 --------------------- org.eclipse.jdt.core/META-INF/MANIFEST.MF | 2 +- .../eclipse/jdt/internal/compiler/ClassFile.java | 27 ++++-- org.eclipse.jdt.core/pom.xml | 2 +- 8 files changed, 58 insertions(+), 120 deletions(-) delete mode 100644 org.eclipse.jdt.core/.settings/.api_filters diff --git a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF index 06473e3aaf..acfe834834 100644 --- a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jdt.core.tests.compiler;singleton:=true -Bundle-Version: 3.12.1000.qualifier +Bundle-Version: 3.12.1100.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.jdt.core.tests.compiler, diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml index a674c791e3..db6c9351e9 100644 --- a/org.eclipse.jdt.core.tests.compiler/pom.xml +++ b/org.eclipse.jdt.core.tests.compiler/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jdt org.eclipse.jdt.core.tests.compiler - 3.12.1000-SNAPSHOT + 3.12.1100-SNAPSHOT eclipse-test-plugin diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java index f1d67a2706..6dad28ad78 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java @@ -52817,7 +52817,7 @@ protected static class Duration implements Comparable { @Override public String toString() { - return "#"+index + " " + durationMs + "ms" + (isExcluded?" (excluded)":""); + return "#"+this.index + " " + this.durationMs + "ms" + (this.isExcluded?" (excluded)":""); } } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java index fcf06d9d42..65a561804a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java @@ -10006,4 +10006,39 @@ public void testBug508834_comment0() { "The method define(FuncN, TODO[]) is ambiguous for the type Test\n" + "----------\n"); } + + public void testBug534223() { + Runner runner = new Runner(); + String sourceX = + "package p;\n" + + "public class X {\n" + + " void m() {\n" + + " Runnable r = () -> {\n" + + " IFC i = new IFC() {\n" + + " public void n(S s) {}\n" + + " };\n" + + " if (i != null)\n" + + " System.out.println(i);\n" + + " };\n" + + " r.run();\n" + + " }\n" + + "}\n"; + runner.testFiles = new String[] { + "p/IFC.java", + "package p;\n" + + "public interface IFC {\n" + + " void n(T t);\n" + + "}\n", + "p/X.java", + sourceX + }; + runner.runConformTest(); + runner.shouldFlushOutputDirectory = false; + runner.testFiles = new String[] { + "p/X.java", + sourceX + }; + runner.runConformTest(); // don't use pre-compiled p/X$1.class + } + } diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters deleted file mode 100644 index f5f3fac15f..0000000000 --- a/org.eclipse.jdt.core/.settings/.api_filters +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF index c3a0b03eee..594a60d7c3 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.20.0.qualifier +Bundle-Version: 3.20.100.qualifier Bundle-Activator: org.eclipse.jdt.core.JavaCore Bundle-Vendor: %providerName Bundle-Localization: plugin 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 578d000f53..9835a4607f 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 @@ -5960,24 +5960,33 @@ public class ClassFile implements TypeConstants, TypeIds { private TypeBinding getNewTypeBinding(char[] typeConstantPoolName, Scope scope) { char[] typeName = typeConstantPoolName; + if (isLikelyLocalTypeName(typeName)) { + // find local type in innerClassesBindings: + Set innerTypeBindings = this.innerClassesBindings.keySet(); + for (TypeBinding binding : innerTypeBindings) { + if (CharOperation.equals(binding.constantPoolName(), typeName)) + return binding; + } + } TypeBinding type = (TypeBinding) scope.getTypeOrPackage(CharOperation.splitOn('/', typeName)); if (!type.isValidBinding()) { ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) type; if ((problemReferenceBinding.problemId() & ProblemReasons.InternalNameProvided) != 0) { type = problemReferenceBinding.closestMatch(); - } else if ((problemReferenceBinding.problemId() & ProblemReasons.NotFound) != 0 && this.innerClassesBindings != null) { - // check local inner types to see if this is a anonymous type - Set innerTypeBindings = this.innerClassesBindings.keySet(); - for (TypeBinding binding : innerTypeBindings) { - if (CharOperation.equals(binding.constantPoolName(), typeName)) { - type = binding; - break; - } - } } } return type; } + + private boolean isLikelyLocalTypeName(char[] typeName) { + int dollarPos = CharOperation.lastIndexOf('$', typeName); + while (dollarPos != -1) { + if (Character.isDigit(typeName[dollarPos+1])) + return true; // name segment starts with a digit => likely a local type (but still "$0" etc. could be part of the source name) + dollarPos = CharOperation.lastIndexOf('$', typeName, 0, dollarPos-1); + } + return false; + } private TypeBinding getANewArrayTypeBinding(char[] typeConstantPoolName, Scope scope) { if (typeConstantPoolName[0] == '[') { diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml index 072033f2fb..7180de1a4c 100644 --- a/org.eclipse.jdt.core/pom.xml +++ b/org.eclipse.jdt.core/pom.xml @@ -18,7 +18,7 @@ org.eclipse.jdt org.eclipse.jdt.core - 3.20.0-SNAPSHOT + 3.20.100-SNAPSHOT eclipse-plugin -- cgit v1.2.3 From 9a0e22c52b9fa57b1fb776fe43aebcb7c97bac18 Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Sat, 14 Dec 2019 16:41:16 +0100 Subject: Bug 404648 - [1.8][compiler] investigate differences between ECJ & javac - fix clean-up attempt from Commit d00d33a7e2d1a4906eb3cf4380c89d9abdb87603--- .../jdt/core/tests/compiler/regression/AbstractRegressionTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java index 8fa8ce9329..6b75b31a30 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java @@ -2441,7 +2441,7 @@ private void deleteSourceFiles(File directory) { if (!directory.exists()) return; Files.walk(directory.toPath()) - .filter(f -> f.endsWith(SuffixConstants.SUFFIX_STRING_java)) + .filter(f -> f.toString().endsWith(SuffixConstants.SUFFIX_STRING_java)) .map(java.nio.file.Path::toFile) .filter(File::isFile) .forEach(File::delete); -- cgit v1.2.3 From b232dab5f7ce89322dae86fcd5334d03116ec929 Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Sun, 15 Dec 2019 13:20:21 +0100 Subject: Bug 404648 - [1.8][compiler] investigate differences between ECJ & javac - adjust JavacTestOptions: +2 SKIP, -1 unused excuse --- .../regression/ProblemTypeAndMethodTest.java | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java index 5e58441cef..29ee0715e3 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java @@ -4821,7 +4821,9 @@ public void test092() { false, false ); - this.runConformTest( + Runner runner = new Runner(); + runner.javacTestOptions = JavacTestOptions.SKIP; // javac did not produce p1/p2/X.class which is needed below + runner.testFiles = new String[] { "a/b/A.java", // ================= "package a.b;\n" + @@ -4833,13 +4835,10 @@ public void test092() { "p2/p3/Z.java", // ================= "package p2.p3;\n" + "public class Z {}\n" - }, - "", - null, - false, - null - ); - this.runConformTest( + }; + runner.shouldFlushOutputDirectory = false; + runner.runConformTest(); + runner.testFiles = new String[] { "a/b/A.java", // ================= "package a.b;\n" + @@ -4848,12 +4847,8 @@ public void test092() { " void test() { x.z(); }\n" + " void foo(p2.p3.Z z) {}\n" + "}\n" - }, - "", - null, - false, - null - ); + }; + runner.runConformTest(); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=250297 - variation public void test093() { @@ -8183,8 +8178,6 @@ public void test376550_11() { " ^\n" + "Read access to enclosing field X.o is emulated by a synthetic accessor method\n" + "----------\n"; - runner.javacTestOptions = - JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings; runner.runWarningTest(); } @@ -8762,6 +8755,8 @@ public void testBug542829() { "----------\n"; runner.runNegativeTest(); + runner.javacTestOptions = JavacTestOptions.SKIP; // javac did not produce b/Roken.class which is needed below + // restore the class as binary: runner.testFiles = new String[] { nameMissing, -- cgit v1.2.3 From bea783c841d5c85a86f047b715181e363e74ba62 Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Fri, 6 Dec 2019 23:59:59 +0100 Subject: Bug 553885 - BootstrapMethodError for method reference to inherited non-public default method See https://bugs.openjdk.java.net/browse/JDK-8068253 as root cause and https://bugs.openjdk.java.net/browse/JDK-8068254 as workaround in javac. Reference expressions to default methods from package protected interfaces should use implicit lambda methods to avoid runtime errors. Change-Id: Iec5121bd4d8814a4348519dd25efc454deb61908 Signed-off-by: Andrey Loskutov Also-by: Stephan Herrmann --- .../compiler/regression/LambdaExpressionsTest.java | 103 +++++++++++++++++++++ .../internal/compiler/ast/ReferenceExpression.java | 4 +- 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java index 5be3c39bc7..b11075770d 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java @@ -6846,6 +6846,109 @@ public void testBug529199() { "A.m" ); } +public void testBug553885a() { + runConformTest( + new String[] { + "p2/Test.java", + "package p2;\n" + + "import java.util.Optional;\n" + + "import p1.B;\n" + + "import p1.BImpl;\n" + + "\n" + + "public class Test {\n" + + " public static void main(String[] args) {\n" + + " Optional map = Optional.of(new BImpl()).map(B::amount);\n" + + " System.out.print(map);\n" + + " }\n" + + "}", + "p1/A.java", + "package p1;\n" + + "interface A {\n" + + " default int amount() {\n" + + " return 0;\n" + + " }\n" + + "}\n", + "p1/B.java", + "package p1;\n" + + "public interface B extends A {}\n" + + "\n", + "p1/BImpl.java", + "package p1;\n" + + "public class BImpl implements B {}\n", + }, + "Optional[0]" + ); +} +public void testBug553885b() { + runConformTest( + new String[] { + "p2/Test.java", + "package p2;\n" + + "import java.util.Optional;\n" + + "import p1.B;\n" + + "import p1.BImpl;\n" + + "\n" + + "public class Test {\n" + + " public static void main(String[] args) {\n" + + " B b = new BImpl();\n" + // lead inference towards Optional instead of Optional + " Optional map = Optional.of(b).map(B::amount);\n" + + " System.out.print(map);\n" + + " }\n" + + "}", + "p1/A.java", + "package p1;\n" + + "interface A {\n" + + " default int amount() {\n" + + " return 0;\n" + + " }\n" + + "}\n", + "p1/B.java", + "package p1;\n" + + "public interface B extends A {}\n" + + "\n", + "p1/BImpl.java", + "package p1;\n" + + "public class BImpl implements B {}\n", + }, + "Optional[0]" + ); +} +public void testBug553885c() { + // classes instead of interface with default method + runConformTest( + new String[] { + "p2/Test.java", + "package p2;\n" + + "import java.util.Optional;\n" + + "import p1.B;\n" + + "import p1.BImpl;\n" + + "\n" + + "public class Test {\n" + + " public static void main(String[] args) {\n" + + " B b = new BImpl();\n" + + " Optional map = Optional.of(b).map(B::amount);\n" + + " System.out.print(map);\n" + + " }\n" + + "}", + "p1/A.java", + "package p1;\n" + + "class A {\n" + + " public int amount() {\n" + + " return 0;\n" + + " }\n" + + "}\n", + "p1/B.java", + "package p1;\n" + + "public class B extends A {}\n" + + "\n", + "p1/BImpl.java", + "package p1;\n" + + "public class BImpl extends B {}\n", + }, + "Optional[0]" + ); +} + public void testBug521182() { runConformTest( new String[] { 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 cfa39258eb..dc687c59df 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 @@ -287,9 +287,11 @@ public class ReferenceExpression extends FunctionalExpression implements IPolyEx if (TypeBinding.notEquals(this.binding.declaringClass, this.lhs.resolvedType.erasure())) { // reference to a method declared by an inaccessible type accessed via a // subtype - normally a bridge method would be present to facilitate - // this access, unless the method is final/static, in which case, direct access to + // this access, unless the method is final/static/default, in which case, direct access to // the method is not possible, an implicit lambda is needed if (!this.binding.declaringClass.canBeSeenBy(this.enclosingScope)) { + if (this.binding.isDefaultMethod()) + return false; // workaround for bug in MethodHandle lookup, see https://bugs.openjdk.java.net/browse/JDK-8068253 return !(this.binding.isFinal() || this.binding.isStatic()); } } -- cgit v1.2.3 From 3ff9186163506e12e3283335bc32f49dad643c22 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Sun, 8 Dec 2019 23:38:01 +0100 Subject: Bug 558004 - Several NPEs when compiling module declarations after 549855 Change-Id: I7fda5a76775ce8b627bcbae4f027a778de15b55b Signed-off-by: Christoph Langer --- .../jdt/core/tests/model/ModuleBuilderTests.java | 25 ++++++++++++++++++++++ .../eclipse/jdt/internal/compiler/ast/Javadoc.java | 10 +++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java index 4c83d917ee..f94c7492cf 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java @@ -8689,6 +8689,31 @@ public class ModuleBuilderTests extends ModifyingResourceTests { deleteProject("lib"); } } + + public void testBug558004() throws CoreException { + IJavaProject prj = createJava9Project("A"); + try { + String moduleinfopath = "A/src/module-info.java"; + String moduleinfosrc = + "/**\n" + + " * The {@link java.nio.file.FileSystems#newFileSystem FileSystems.newFileSystem(URI.create(\"jrt:/\"))}\n" + + " */\n" + + "module modulartest11 {\n" + + "}\n"; + createFile(moduleinfopath, moduleinfosrc); + getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null); + assertNoErrors(); + this.problemRequestor.initialize(moduleinfosrc.toCharArray()); + getCompilationUnit("A/src/module-info.java").getWorkingCopy(this.wcOwner, null); + assertProblems("unexpected problems", + "----------\n" + + "----------\n", + this.problemRequestor); + } finally { + deleteProject(prj); + } + } + public void testBug547479() throws CoreException { int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java index 087d33fc8f..c00df74cae 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java @@ -423,7 +423,8 @@ public class Javadoc extends ASTNode { scope.problemReporter().javadocInvalidValueReference(fieldRef.sourceStart, fieldRef.sourceEnd, scopeModifiers); } else if (fieldRef.actualReceiverType != null) { - if (scope.enclosingSourceType().isCompatibleWith(fieldRef.actualReceiverType)) { + SourceTypeBinding stb = scope.enclosingSourceType(); + if (stb != null && stb.isCompatibleWith(fieldRef.actualReceiverType)) { fieldRef.bits |= ASTNode.SuperAccess; } ReferenceBinding resolvedType = (ReferenceBinding) fieldRef.actualReceiverType; @@ -964,8 +965,9 @@ public class Javadoc extends ASTNode { ClassScope topLevelScope = scope.classScope(); // when scope is not on compilation unit type, then inner class may not be visible... - if (topLevelScope.parent.kind != Scope.COMPILATION_UNIT_SCOPE || - !CharOperation.equals(topLevelType.sourceName, topLevelScope.referenceContext.name)) { + if (topLevelScope != null && + (topLevelScope.parent.kind != Scope.COMPILATION_UNIT_SCOPE || + !CharOperation.equals(topLevelType.sourceName, topLevelScope.referenceContext.name))) { topLevelScope = topLevelScope.outerMostClassScope(); if (typeReference instanceof JavadocSingleTypeReference) { // inner class single reference can only be done in same unit @@ -1014,7 +1016,7 @@ public class Javadoc extends ASTNode { // partially qualified references from a different CU should be warned char[][] typeRefName = ((JavadocQualifiedTypeReference) typeReference).getTypeName(); int skipLength = 0; - if (topLevelScope.getCurrentPackage() == resolvedType.getPackage() + if (topLevelScope != null && topLevelScope.getCurrentPackage() == resolvedType.getPackage() && typeRefName.length < computedCompoundName.length) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=221539: references can be partially qualified // in same package and hence if the package name is not given, ignore package name check -- cgit v1.2.3