Skip to content

Commit

Permalink
Fix Eclipse warnings (#126)
Browse files Browse the repository at this point in the history
- In order to take advantage of the warnings in Eclipse the
**CheckStyle** plugin has been restarted (ie: it was no longer correctly
configured) and all files whose code did not meet the requirements of
the `/build/checkstyle.xml` file have been updated. It is expected that
the file headers (license and copyright) will be modified in order to
avoid the last warnings still visible in Eclipse.
- Java 17 is now the minimum version. This seem to be required by the
various Eclipse archives that LOEclipse uses (ie: org.eclipse.jdt).
- The template java file
`java/source/org/libreoffice/ide/eclipse/java/registration/RegistrationHandler.java.tpl`
has been rewritten using generics so that Eclipse warnings stop.
- The test file
`core/source/org/libreoffice/ide/eclipse/core/wizards/pages/ManifestExportPageControllerTest.java`
has been moved to the
`core/source/org/libreoffice/ide/eclipse/core/unittests` folder to allow
error-free compilation. This seems to fix [issue
#125](#125).
- All Java methods marked as deprecated have been updated to their
replacement method.

Following this PR there are still in the Eclipse problems:
- 21 warnings including 4 TODO.
- 72 infos corresponding to the file headers (license and copyright).
  • Loading branch information
prrvchr authored Jan 13, 2025
1 parent 67437ab commit 847ce5f
Show file tree
Hide file tree
Showing 247 changed files with 4,787 additions and 4,205 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java_source = 1.8
java_target = 1.8
java_source = 17
java_target = 17
10 changes: 10 additions & 0 deletions build/.checkstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>

<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<local-check-config name="loeclipseintegration style" location="checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="loeclipseintegration style" local="true">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
</fileset-config>
6 changes: 6 additions & 0 deletions build/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions build/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
33 changes: 16 additions & 17 deletions build/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
-->
<module name="Checker">
<property name="severity" value="warning"/>
<module name="FileTabCharacter"/>
<module name="LineLength">
<property name="max" value="120"/>
<property name="fileExtensions" value="java"/>
</module>
<module name="RegexpHeader">
<property name="severity" value="info"/>
<property name="headerFile" value="${samedir}/header.txt"/>
<property name="fileExtensions" value="java"/>
</module>
<module name="TreeWalker">
<module name="LeftCurly"/>
<module name="RightCurly"/>
Expand All @@ -29,10 +39,9 @@
<module name="SimplifyBooleanReturn"/>
<module name="StaticVariableName">
<property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>
<property name="applyToPublic" value="false"/>
</module>
<module name="ParameterName">
<property name="format" value="^p[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="ParameterName"/>
<module name="MemberName">
<property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
</module>
Expand All @@ -51,34 +60,24 @@
</module>
<module name="SimplifyBooleanExpression"/>
<module name="BooleanExpressionComplexity"/>
<module name="CyclomaticComplexity"/>
<module name="CyclomaticComplexity">
<property name="switchBlockAsSingleDecisionPoint" value="true"/>
</module>
<module name="JavaNCSS"/>
<module name="NPathComplexity"/>
<module name="TodoComment">
<property name="format" value="TODO"/>
<metadata name="com.atlassw.tools.eclipse.checkstyle.customMessage" value="TODO comment left"/>
</module>
<module name="AvoidNestedBlocks"/>
<module name="UnusedImports">
<property name="severity" value="info"/>
</module>
<module name="JavadocMethod">
<property name="logLoadErrors" value="true"/>
<property name="suppressLoadErrors" value="true"/>
</module>
<module name="JavadocMethod"/>
<module name="JavadocStyle"/>
<module name="JavadocType"/>
<module name="LineLength">
<property name="max" value="120"/>
</module>
<module name="Indentation"/>
<module name="EmptyBlock">
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,STATIC_INIT"/>
</module>
</module>
<module name="RegexpHeader">
<property name="severity" value="info"/>
<property name="headerFile" value="${samedir}/header.txt"/>
</module>
<module name="FileTabCharacter"/>
</module>
96 changes: 56 additions & 40 deletions build/features/java/feature.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature id="org.libreoffice.ide.eclipse.java" label="LibreOffice Extension/Component Development - Java" version="${java.Bundle-Version}" provider-name="The Document Foundation">
<description>
<feature
id="org.libreoffice.ide.eclipse.java"
label="LibreOffice Extension/Component Development - Java"
version="${java.Bundle-Version}"
provider-name="The Document Foundation">

<description>
This plugin provides helps with developing Java extensions or components for LibreOffice.
</description>
<copyright>

<copyright>
Copyright: (c) 2005-2010 Cedric Bosdonnat
</copyright>
<license url="http://www.gnu.org/licenses/lgpl.txt">
</copyright>

<license url="http://www.gnu.org/licenses/lgpl.txt">
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/
Expand All @@ -16,24 +23,24 @@ This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU
Lesser General Public License, and the "GNU GPL" refers to version 3
As used herein, &quot;this License&quot; refers to version 3 of the GNU
Lesser General Public License, and the &quot;GNU GPL&quot; refers to version 3
of the GNU General Public License.
"The Library" refers to a covered work governed by this License,
&quot;The Library&quot; refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
An &quot;Application&quot; is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed
a mode of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking
A &quot;Combined Work&quot; is a work produced by combining or linking
an Application with the Library. The particular version of the
Library with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means
Library with which the Combined Work was made is also called the &quot;Linked
Version&quot;.
The &quot;Minimal Corresponding Source&quot; for a Combined Work means
the Corresponding Source for the Combined Work, excluding any source
code for portions of the Combined Work that, considered in isolation,
are based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means
The &quot;Corresponding Application Code&quot; for a Combined Work means
the object code and/or source code for the Application, including
any data and utility programs needed for reproducing the Combined Work
from the Application, but excluding the System Libraries of the Combined
Expand Down Expand Up @@ -90,7 +97,7 @@ manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
a copy of the Library already present on the user&apos;s computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
Expand Down Expand Up @@ -124,7 +131,7 @@ new versions will be similar in spirit to the present version, but
may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered
version of the GNU Lesser General Public License "or any later version"
version of the GNU Lesser General Public License &quot;or any later version&quot;
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as
Expand All @@ -133,7 +140,7 @@ General Public License, you may choose any version of the GNU
Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can
decide whether future versions of the GNU Lesser General Public License
shall apply, that proxy's public statement of acceptance of any version
shall apply, that proxy&apos;s public statement of acceptance of any version
is permanent authorization for you to choose that version for the
Library.
GNU LESSER GENERAL PUBLIC LICENSE
Expand All @@ -145,25 +152,25 @@ This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU
Lesser General Public License, and the "GNU GPL" refers to
As used herein, &quot;this License&quot; refers to version 3 of the GNU
Lesser General Public License, and the &quot;GNU GPL&quot; refers to
version 3 of the GNU General Public License.
"The Library" refers to a covered work governed by this License,
&quot;The Library&quot; refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
An &quot;Application&quot; is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed
a mode of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking
A &quot;Combined Work&quot; is a work produced by combining or linking
an Application with the Library. The particular version of the
Library with which the Combined Work was made is also called the
"Linked Version".
The "Minimal Corresponding Source" for a Combined Work means
&quot;Linked Version&quot;.
The &quot;Minimal Corresponding Source&quot; for a Combined Work means
the Corresponding Source for the Combined Work, excluding any
source code for portions of the Combined Work that, considered
in isolation, are based on the Application, and not on the
Linked Version.
The "Corresponding Application Code" for a Combined Work means
The &quot;Corresponding Application Code&quot; for a Combined Work means
the object code and/or source code for the Application,
including any data and utility programs needed for reproducing
the Combined Work from the Application, but excluding the System
Expand Down Expand Up @@ -221,7 +228,7 @@ manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
a copy of the Library already present on the user&apos;s computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
Expand Down Expand Up @@ -280,8 +287,8 @@ new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered
version of the GNU Lesser General Public License "or any later
version" applies to it, you have the option of following the
version of the GNU Lesser General Public License &quot;or any later
version&quot; applies to it, you have the option of following the
terms and conditions either of that published version or of
any later version published by the Free Software Foundation.
If the Library as you received it does not specify a version
Expand All @@ -290,11 +297,11 @@ any version of the GNU Lesser General Public License ever
published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can
decide whether future versions of the GNU Lesser General Public
License shall apply, that proxy's public statement of acceptance
License shall apply, that proxy&apos;s public statement of acceptance
of any version is permaneinguishing version number. If the
Library as you received it specifies that a certain numbered
version of the GNU Lesser General Public License "or any later
version" applies to it, you have the option of following the
version of the GNU Lesser General Public License &quot;or any later
version&quot; applies to it, you have the option of following the
terms and conditions either of that published version or of
any later version published by the Free Software Foundation.
If the Library as you received it does not specify a version
Expand All @@ -303,16 +310,25 @@ any version of the GNU Lesser General Public License ever
published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can
decide whether future versions of the GNU Lesser General Public
License shall apply, that proxy's public statement of acceptance
License shall apply, that proxy&apos;s public statement of acceptance
of any version is permanent authorization for you to choose that
version for the Library.
</license>
<url>
<update label="LOEclipse Update Site" url="https://eclipse-plugins.libreoffice.org"/>
</url>
<requires>
<import feature="org.eclipse.jdt"/>
</requires>
<plugin id="org.libreoffice.ide.eclipse.java" download-size="0" install-size="0" version="${java.Bundle-Version}" unpack="false"/>
<plugin id="org.libreoffice.ide.eclipse.core" download-size="0" install-size="0" version="${core.Bundle-Version}" unpack="false"/>

<url>
<update label="LOEclipse Update Site" url="https://eclipse-plugins.libreoffice.org"/>
</url>

<requires>
<import feature="org.eclipse.jdt" version="3.20.0.v20241120-1800"/>
</requires>

<plugin
id="org.libreoffice.ide.eclipse.java"
version="${java.Bundle-Version}"/>

<plugin
id="org.libreoffice.ide.eclipse.core"
version="${core.Bundle-Version}"/>

</feature>
14 changes: 4 additions & 10 deletions build/features/python/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,22 +320,16 @@ version for the Library.
</url>

<requires>
<import feature="org.eclipse.jdt"/>
<import feature="org.python.pydev.feature"/>
<import feature="org.eclipse.jdt" version="3.20.0.v20241120-1800"/>
<import feature="org.python.pydev.feature" version="12.2.0.202409031913"/>
</requires>

<plugin
id="org.libreoffice.ide.eclipse.python"
download-size="0"
install-size="0"
version="${python.Bundle-Version}"
unpack="false"/>
version="${python.Bundle-Version}"/>

<plugin
id="org.libreoffice.ide.eclipse.core"
download-size="0"
install-size="0"
version="${core.Bundle-Version}"
unpack="false"/>
version="${core.Bundle-Version}"/>

</feature>
2 changes: 1 addition & 1 deletion build/header.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
^ \* License along with this library; if not, write to the Free Software$
^ \* Foundation, Inc., 59 Temple Place, Suite 330, Boston,$
^ \* MA 02111-1307 USA$
^ \* $
^ \*$
^ \* The Initial Developer of the Original Code is: Sun Microsystems, Inc..$
^ \*$
^ \* Copyright: 2002 by Sun Microsystems, Inc.$
Expand Down
6 changes: 3 additions & 3 deletions core/.checkstyle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<fileset-config file-format-version="1.2.0" simple-config="true">
<local-check-config name="loeclipseintegration style" location="/org.libreoffice.ide.eclipse.build/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="false"/>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<local-check-config name="loeclipseintegration style" location="build/checkstyle.xml" type="project" description="">
<additional-data name="protect-config-file" value="true"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="loeclipseintegration style" local="true">
<file-match-pattern match-pattern="." include-pattern="true"/>
Expand Down
8 changes: 6 additions & 2 deletions core/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="src" path="source"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/LO-Classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions core/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Loading

0 comments on commit 847ce5f

Please sign in to comment.