Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish o.e.help.base move to Lucene 10 and Java 21 #1659

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.base/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin2" path="src_ant"/>
Expand Down
6 changes: 3 additions & 3 deletions ua/org.eclipse.help.base/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -101,7 +101,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.compiler.source=21
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
Expand Down
10 changes: 5 additions & 5 deletions ua/org.eclipse.help.base/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %help_base_plugin_name
Bundle-SymbolicName: org.eclipse.help.base; singleton:=true
Bundle-Version: 4.4.700.qualifier
Bundle-Version: 4.5.0.qualifier
Bundle-Activator: org.eclipse.help.internal.base.HelpBasePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down Expand Up @@ -43,10 +43,10 @@ Require-Bundle: org.eclipse.ant.core;bundle-version="[3.2.200,4.0.0)";resolution
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.help;bundle-version="[3.5.0,4.0.0)";visibility:=reexport,
org.eclipse.core.net;bundle-version="[1.2.200,2.0.0)",
org.apache.lucene.analysis-common;bundle-version="[9.5.0,11.0.0)",
org.apache.lucene.core;bundle-version="[9.5.0,11.0.0)",
org.apache.lucene.analysis-smartcn;bundle-version="[9.5.0,11.0.0)"
org.apache.lucene.analysis-common;bundle-version="[10.0.0,11.0.0)",
org.apache.lucene.core;bundle-version="[10.0.0,11.0.0)",
org.apache.lucene.analysis-smartcn;bundle-version="[10.0.0,11.0.0)"
Import-Package: org.eclipse.equinox.http.jetty;resolution:=optional
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: org.eclipse.help.base
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.help</groupId>
<artifactId>org.eclipse.help.base</artifactId>
<version>4.4.700-SNAPSHOT</version>
<version>4.5.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -206,7 +206,7 @@
url = base + "/" + href; //$NON-NLS-1$
}
try {
return new URL(url);

Check warning on line 209 in ua/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler and API Tools

Deprecation

NORMAL: The constructor URL(String) is deprecated since version 20
} catch (MalformedURLException e) {
return null;
}
Expand All @@ -229,7 +229,7 @@
}
}
try {
return new URL(url);

Check warning on line 232 in ua/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler and API Tools

Deprecation

NORMAL: The constructor URL(String) is deprecated since version 20
}
catch (MalformedURLException e) {
return null;
Expand Down Expand Up @@ -324,16 +324,13 @@
Class<?> c = bundle.loadClass(className);
Object o = c.getDeclaredConstructor().newInstance();
//Runnable runnable = null;
if (o instanceof ILiveHelpAction) {
ILiveHelpAction helpExt = (ILiveHelpAction) o;
if (o instanceof ILiveHelpAction helpExt) {
if (arg != null)
helpExt.setInitializationString(arg);
Thread runnableLiveHelp = new Thread(helpExt);
runnableLiveHelp.setDaemon(true);
runnableLiveHelp.start();
}
} catch (ThreadDeath td) {
throw td;
} catch (Exception e) {
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -46,10 +46,10 @@ public synchronized Object start(IApplicationContext context) throws Exception {
}
Locale locale;
if (localeStr.length() >= 5) {
locale = new Locale(localeStr.substring(0, 2), localeStr.substring(3, 5));
locale = Locale.of(localeStr.substring(0, 2), localeStr.substring(3, 5));
}
else {
locale = new Locale(localeStr.substring(0, 2), ""); //$NON-NLS-1$
locale = Locale.of(localeStr.substring(0, 2), ""); //$NON-NLS-1$
}
preindex(directory, locale);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the
* accompanying materials are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -53,7 +53,7 @@ public DefaultAnalyzer(String localeString) {
}
if (locale == null && userLocale.getDisplayVariant().length() > 0) {
// Check if the locale without variant is supported by BreakIterator
Locale countryLocale = new Locale(userLocale.getLanguage(), userLocale.getCountry());
Locale countryLocale = Locale.of(userLocale.getLanguage(), userLocale.getCountry());
for (Locale availableLocale : availableLocales) {
if (countryLocale.equals(availableLocale)) {
locale = countryLocale;
Expand All @@ -63,7 +63,7 @@ public DefaultAnalyzer(String localeString) {
}
if (locale == null && userLocale.getCountry().length() > 0) {
// Check if at least the language is supported by BreakIterator
Locale language = new Locale(userLocale.getLanguage(), ""); //$NON-NLS-1$
Locale language = Locale.of(userLocale.getLanguage(), ""); //$NON-NLS-1$
for (Locale availableLocale : availableLocales) {
if (language.equals(availableLocale)) {
locale = language;
Expand All @@ -79,7 +79,7 @@ public DefaultAnalyzer(String localeString) {
+ localeString
+ ", or Java Virtual Machine needs to be upgraded to version with proper support for locale {0}.", //$NON-NLS-1$
null);
locale = new Locale("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$
locale = Locale.of("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$
}
}

Expand All @@ -95,11 +95,11 @@ private Locale getLocale(String clientLocale) {
// break the string into tokens to get the Locale object
StringTokenizer locales = new StringTokenizer(clientLocale, "_"); //$NON-NLS-1$
if (locales.countTokens() == 1)
return new Locale(locales.nextToken(), ""); //$NON-NLS-1$
return Locale.of(locales.nextToken(), ""); //$NON-NLS-1$
else if (locales.countTokens() == 2)
return new Locale(locales.nextToken(), locales.nextToken());
return Locale.of(locales.nextToken(), locales.nextToken());
else if (locales.countTokens() == 3)
return new Locale(locales.nextToken(), locales.nextToken(), locales.nextToken());
return Locale.of(locales.nextToken(), locales.nextToken(), locales.nextToken());
else
return Locale.getDefault();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -14,20 +14,28 @@
* Sopot Cela - Bug 466829
*******************************************************************************/
package org.eclipse.help.internal.search;
import java.io.*;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.StringTokenizer;

import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.index.*;
import org.apache.lucene.search.*;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BooleanQuery.Builder;
import org.eclipse.help.internal.base.*;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.PhraseQuery;
import org.apache.lucene.search.Query;
import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.base.HelpBasePlugin;
/**
* Build query acceptable by the search engine.
*/
Expand Down Expand Up @@ -57,10 +65,9 @@ public QueryBuilder(String searchWords, AnalyzerDescriptor analyzerDesc) {
this.searchWords = searchWords;
String language = analyzerDesc.getLang();
if (language.length() >= 5) {
this.locale = new Locale(language.substring(0, 2), language
.substring(3, 5));
this.locale = Locale.of(language.substring(0, 2), language.substring(3, 5));
} else {
this.locale = new Locale(language.substring(0, 2), ""); //$NON-NLS-1$
this.locale = Locale.of(language.substring(0, 2), ""); //$NON-NLS-1$
}
this.analyzerDesc = analyzerDesc;
this.analyzer = analyzerDesc.getAnalyzer();
Expand Down Expand Up @@ -297,8 +304,7 @@ private List<Query> getRequiredQueries(List<QueryWordsToken> tokens, String[] fi
}
private Query orQueries(Collection<Query> queries) {
Builder builder = new BooleanQuery.Builder();
for (Iterator<Query> it = queries.iterator(); it.hasNext();) {
Query q = it.next();
for (Query q : queries) {
builder.add(q, BooleanClause.Occur.SHOULD);
}
return builder.build();
Expand Down
Loading