From f10a370df8b8bf6a1de00f9ac216936cdd7e397e Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 16 Oct 2025 20:01:20 +0100 Subject: [PATCH] Update jdt to 1.51.0 --- .github/workflows/ci.yml | 4 +- build.py | 9 ++-- .../language_server_completer.py | 15 +++++- ycmd/tests/java/diagnostics_test.py | 5 +- ycmd/tests/java/subcommands_test.py | 51 ++----------------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 28 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c7c8dc15b..3c979aa268 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: if: matrix.benchmark == false uses: actions/setup-java@v4 with: - java-version: 17 + java-version: 21 distribution: 'adopt' - name: Install Python @@ -243,7 +243,7 @@ jobs: # if: matrix.benchmark == false # uses: actions/setup-java@v4 # with: - # java-version: 17 + # java-version: 21 # distribution: 'temurin' # - name: Install Python # uses: actions/setup-python@v5 diff --git a/build.py b/build.py index 9f164622b6..9c78b6930c 100755 --- a/build.py +++ b/build.py @@ -89,10 +89,11 @@ def Exit( self ): )$ """ -JDTLS_MILESTONE = '1.40.0' -JDTLS_BUILD_STAMP = '202409261450' +JDTLS_REQUIRED_JAVA_VERSION = 21 +JDTLS_MILESTONE = '1.51.0' +JDTLS_BUILD_STAMP = '202510022025' JDTLS_SHA256 = ( - '7416fc62befa450e32f06ec2b503f2eec5f22f0b1cc12f7b8ee5112bf671cf11' + '8a59372117881bf5bdc0220f2254472846b88137c058f344b00a7d41427745a1' ) DEFAULT_RUST_TOOLCHAIN = 'stable' @@ -1110,7 +1111,7 @@ def Print( *args, **kwargs ): sys.stdout.write( 'Installing jdt.ls for Java support...' ) sys.stdout.flush() - CheckJavaVersion( 17 ) + CheckJavaVersion( JDTLS_REQUIRED_JAVA_VERSION ) TARGET = p.join( DIR_OF_THIRD_PARTY, 'eclipse.jdt.ls', 'target', ) REPOSITORY = p.join( TARGET, 'repository' ) diff --git a/ycmd/completers/language_server/language_server_completer.py b/ycmd/completers/language_server/language_server_completer.py index d8a7ee7222..4fcee10f68 100644 --- a/ycmd/completers/language_server/language_server_completer.py +++ b/ycmd/completers/language_server/language_server_completer.py @@ -586,8 +586,19 @@ def _HandleDynamicRegistrations( self, request ): for watcher in reg[ 'registerOptions' ][ 'watchers' ]: # TODO: Take care of watcher kinds. Not everything needs # to be watched for create, modify *and* delete actions. - pattern = os.path.join( self._project_directory, - watcher[ 'globPattern' ] ) + + base, pattern = self._project_directory, watcher[ 'globPattern' ] + if isinstance( pattern, dict ): + # RelativePattern + base, pattern = ( + watcher[ 'globPattern' ][ 'baseUri' ], + watcher[ 'globPattern' ][ 'pattern' ] + ) + if isinstance( base, dict ): + # WorkspaceFolder + base = base[ 'uri' ] + + pattern = os.path.join( base, pattern ) if os.path.isdir( pattern ): pattern = os.path.join( pattern, '**' ) globs.append( pattern ) diff --git a/ycmd/tests/java/diagnostics_test.py b/ycmd/tests/java/diagnostics_test.py index b3edc50d63..8aaefc57c5 100644 --- a/ycmd/tests/java/diagnostics_test.py +++ b/ycmd/tests/java/diagnostics_test.py @@ -34,6 +34,7 @@ PathToTestFile, SharedYcmd, StartJavaCompleterServerInDirectory, + StartJavaCompleterServerWithFile, setUpModule, tearDownModule ) @@ -72,7 +73,6 @@ def ProjectPath( *args ): 'Test.java' ) DIAG_MATCHERS_PER_FILE = { - PathToTestFile( DEFAULT_PROJECT_DIR ): empty(), TestFactory: contains_inanyorder( has_entries( { 'kind': 'WARNING', @@ -321,8 +321,7 @@ def test_FileReadyToParse_Diagnostics_Simple( self, app ): @WithRetry() @IsolatedYcmd() def test_Poll_Diagnostics_ProjectWide_Eclipse( self, app ): - StartJavaCompleterServerInDirectory( app, - PathToTestFile( DEFAULT_PROJECT_DIR ) ) + StartJavaCompleterServerWithFile( app, TestFactory ) filepath = TestLauncher contents = ReadFile( filepath ) diff --git a/ycmd/tests/java/subcommands_test.py b/ycmd/tests/java/subcommands_test.py index 4b124f7d09..ced89f071c 100644 --- a/ycmd/tests/java/subcommands_test.py +++ b/ycmd/tests/java/subcommands_test.py @@ -184,7 +184,7 @@ def RunFixItTest( app, result = RunTest( app, test ) if result[ 'fixits' ]: resolved_fixits[ 'fixits' ].append( result[ 'fixits' ][ 0 ] ) - print( 'completer response: ', json.dumps( resolved_fixits ) ) + print( 'completer response: ', json.dumps( resolved_fixits, indent = 2 ) ) assert_that( resolved_fixits, fixits_for_line ) @@ -1266,21 +1266,12 @@ def test_Subcommands_FixIt_SingleDiag_SingleOption_Modify( self, app ): fixits = has_entries( { 'fixits': contains_inanyorder( - has_entries( { - 'text': "Change type of 'test' to 'boolean'", - 'kind': 'quickfix', - 'chunks': contains_exactly( - ChunkMatcher( 'boolean', - LocationMatcher( filepath, 14, 12 ), - LocationMatcher( filepath, 14, 15 ) ), - ), - } ), has_entries( { 'text': 'Generate toString()', 'kind': 'source.generate.toString', 'chunks': contains_exactly( - ChunkMatcher( '\n\n@Override\npublic String toString() {' - '\n return "TestFactory []";\n}', + ChunkMatcher( '\n\n @Override\n public String toString() {' + '\n return "TestFactory []";\n }', LocationMatcher( filepath, 32, 4 ), LocationMatcher( filepath, 32, 4 ) ), ), @@ -1294,19 +1285,6 @@ def test_Subcommands_FixIt_SingleDiag_SingleOption_Modify( self, app ): LocationMatcher( filepath, 3, 1 ) ), ), } ), - has_entries( { - 'text': 'Change modifiers to final where possible', - 'kind': 'source.generate.finalModifiers', - 'chunks': contains_exactly( - ChunkMatcher( - 'final Wibble w ) {\n if ( w == Wibble.CUTHBERT ) {' - '\n }\n }\n\n public AbstractTestWidget getWidget' - '( final String info ) {\n final AbstractTestWidget' - ' w = new TestWidgetImpl( info );\n final ', - LocationMatcher( filepath, 18, 24 ), - LocationMatcher( filepath, 25, 5 ) ), - ), - } ), has_entries( { 'text': "Add Javadoc comment" } ), @@ -1465,10 +1443,6 @@ def test_Subcommands_FixIt_MultipleDiags( self, app ): 'text': "Organize imports", 'chunks': instance_of( list ), } ), - has_entries( { - 'text': 'Change modifiers to final where possible', - 'chunks': instance_of( list ), - } ), has_entries( { 'text': "Add Javadoc comment", 'chunks': instance_of( list ), @@ -1740,27 +1714,12 @@ def test_Subcommands_FixIt_InvalidURI( self, app ): LocationMatcher( '', 3, 1 ) ), ), } ), - has_entries( { - 'text': 'Change modifiers to final where possible', - 'kind': 'source.generate.finalModifiers', - 'chunks': contains_exactly( - ChunkMatcher( "final Wibble w ) {\n " - "if ( w == Wibble.CUTHBERT ) {" - "\n }\n }\n\n public " - "AbstractTestWidget getWidget" - "( final String info ) {\n final " - "AbstractTestWidget w = new TestWidgetImpl( info );" - "\n final ", - LocationMatcher( '', 18, 24 ), - LocationMatcher( '', 25, 5 ) ), - ), - } ), has_entries( { 'text': 'Generate toString()', 'kind': 'source.generate.toString', 'chunks': contains_exactly( - ChunkMatcher( '\n\n@Override\npublic String toString() {' - '\n return "TestFactory []";\n}', + ChunkMatcher( '\n\n @Override\n public String toString() {' + '\n return "TestFactory []";\n }', LocationMatcher( '', 32, 4 ), LocationMatcher( '', 32, 4 ) ), ), diff --git a/ycmd/tests/java/testdata/gradle-init/gradle/wrapper/gradle-wrapper.properties b/ycmd/tests/java/testdata/gradle-init/gradle/wrapper/gradle-wrapper.properties index 09523c0e54..2e1113280e 100644 --- a/ycmd/tests/java/testdata/gradle-init/gradle/wrapper/gradle-wrapper.properties +++ b/ycmd/tests/java/testdata/gradle-init/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME