@@ -11,8 +11,7 @@ import { logger } from './log';
1111import { addLombokParam , isLombokSupportEnabled } from './lombokSupport' ;
1212import { RequirementsData } from './requirements' ;
1313import { IS_WORKSPACE_VMARGS_ALLOWED , getJavaEncoding , getJavaagentFlag , getKey , isInWorkspaceFolder } from './settings' ;
14- import { deleteDirectory , ensureExists , getJavaConfiguration , getTimestamp , getVersion , getVSCodeVariablesMap } from './utils' ;
15-
14+ import { deleteDirectory , ensureExists , getJavaConfiguration , getTimestamp , getVersion , getVSCodeVariablesMap , isInsiderEditor , isPrereleaseOrInsiderVersion } from './utils' ;
1615// eslint-disable-next-line no-var
1716declare var v8debug ;
1817export const DEBUG = ( typeof v8debug === 'object' ) || startedInDebugMode ( ) ;
@@ -237,12 +236,10 @@ function prepareParams(requirements: RequirementsData, workspacePath, context: E
237236 }
238237
239238 const hasJDWP = params . find ( ( param : string ) => param . includes ( 'jdwp' ) ) !== undefined ;
240- const isInsider : boolean = version . includes ( "insider" ) ;
241239 const extVersion = getVersion ( context . extensionPath ) ;
242- const isPreReleaseVersion = / ^ \d + \. \d + \. \d { 10 } / . test ( extVersion ) ;
243240 const globalStoragePath = path . resolve ( context . globalStorageUri ?. fsPath , extVersion ) ; // .../Code/User/globalStorage/redhat.java/1.42.0/
244241 const appCDSMode = workspace . getConfiguration ( ) . get ( 'java.jdt.ls.appcds.enabled' ) ;
245- const useAppCDS = ( appCDSMode === 'on' ) || ( appCDSMode === 'auto' && ( isInsider || isPreReleaseVersion ) ) ;
242+ const useAppCDS = ( appCDSMode === 'on' ) || ( appCDSMode === 'auto' && ( isPrereleaseOrInsiderVersion ( context ) ) ) ;
246243
247244 ensureExists ( globalStoragePath ) ;
248245 const sharedArchiveLocation = path . join ( globalStoragePath , "jdtls.jsa" ) ;
@@ -290,7 +287,7 @@ function prepareParams(requirements: RequirementsData, workspacePath, context: E
290287function resolveIndexCache ( context : ExtensionContext ) {
291288 let enabled : string = getJavaConfiguration ( ) . get ( "sharedIndexes.enabled" ) ;
292289 if ( enabled === "auto" ) {
293- enabled = version . includes ( "insider" ) ? "on" : "off" ;
290+ enabled = isInsiderEditor ( ) ? "on" : "off" ;
294291 }
295292
296293 if ( enabled !== "on" ) {
0 commit comments