Port to JFlex 1.7.0

This commit is contained in:
Mikolaj Izdebski 2019-06-07 10:40:23 +02:00
parent 256bc86d4e
commit 456c83d1c9
2 changed files with 42 additions and 5 deletions

View File

@ -0,0 +1,39 @@
From 31f530b26bd4625ffe41aa16c48836455ef81c23 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 7 Jun 2019 10:39:34 +0200
Subject: [PATCH] Port to JFlex 1.7.0
---
src/grammar/lexer.flex | 2 +-
.../java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/grammar/lexer.flex b/src/grammar/lexer.flex
index 9b567ff..cd9d5b6 100644
--- a/src/grammar/lexer.flex
+++ b/src/grammar/lexer.flex
@@ -168,7 +168,7 @@ import java.util.*;
}
public JFlexLexer( java.io.InputStream stream, java.io.Writer writer ) {
- this( stream );
+ this( new java.io.InputStreamReader( stream, java.nio.charset.Charset.forName( "UTF-8" ) ) );
this.writer = writer;
}
diff --git a/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java b/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
index c947f9b..5b415c0 100644
--- a/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
+++ b/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
@@ -112,7 +112,7 @@ public class ClassLoaderLibrary
if ( sourceStream != null )
{
Builder builder = getModelBuilder();
- JavaLexer lexer = new JFlexLexer( sourceStream );
+ JavaLexer lexer = new JFlexLexer( new java.io.InputStreamReader( sourceStream, java.nio.charset.Charset.forName( "UTF-8" ) ) );
Parser parser = new Parser( lexer, builder );
parser.setDebugLexer( debugLexer );
parser.setDebugParser( debugParser );
--
2.21.0

View File

@ -14,6 +14,7 @@ Source1: qdox-MANIFEST.MF
# Remove bundled binaries which are possibly proprietary
Source2: generate-tarball.sh
Patch0: 0001-Port-to-JFlex-1.7.0.patch
BuildRequires: maven-local
BuildRequires: mvn(org.apache.maven.plugins:maven-assembly-plugin)
@ -40,6 +41,7 @@ API docs for %{name}.
%prep
%setup -q -n %{name}-%{version}-%{vertag}
%patch0 -p1
find -name *.jar -delete
rm -rf bootstrap
@ -54,10 +56,6 @@ rm -rf bootstrap
%pom_xpath_set pom:workingDirectory '${basedir}/src/main/java/com/thoughtworks/qdox/parser/impl'
# Compatibility with JFlex 1.7.0
sed -i 's/JFlexLexer(\(.*\))/JFlexLexer(new java.io.InputStreamReader((\1), java.nio.charset.Charset.forName("UTF-8")))/' \
src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
%build
# Generate scanners (upstream does this with maven-jflex-plugin)
jflex -d src/main/java/com/thoughtworks/qdox/parser/impl src/grammar/lexer.flex
@ -80,7 +78,7 @@ jar ufm target/%{name}-%{version}*.jar %{SOURCE1}
%changelog
* Fri Jun 07 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.0-5.M9
- Don't use deprecated inputstreamctor option
- Port to JFlex 1.7.0
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.0-4.M9
- Mass rebuild for javapackages-tools 201901