Fridrich Strba 2022-01-12 12:16:00 +00:00 committed by Git OBS Bridge
parent c373b43713
commit 37b32e4cb7
4 changed files with 52 additions and 15 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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:57148d2984cf47473365c86d5affe77a38b11f9982cc24456f9dd98cda820bf6
size 457511

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7656659c8ff8b4e3f6c9b5fd0164bfe2ff7211ccedaa21046e53e63005a6d37b
size 459971

View File

@ -17,7 +17,7 @@
Name: qdox
Version: 2.0.1
Version: 2.0.0
Release: 0
Summary: Tool to extract class/interface/method definitions from sources
License: Apache-2.0
@ -25,6 +25,7 @@ Group: Development/Libraries/Java
URL: https://github.com/paul-hammant/qdox
Source0: https://repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/%{version}/%{name}-%{version}-project.tar.bz2
Source1: qdox-MANIFEST.MF
Patch0: 0001-Port-to-JFlex-1.7.0.patch
BuildRequires: byaccj
BuildRequires: fdupes
BuildRequires: java-cup-bootstrap
@ -47,6 +48,7 @@ API docs for %{name}.
%prep
%setup -q
%patch0 -p1
find -name *.jar -delete
find -name *.class -delete
rm -rf bootstrap
@ -55,6 +57,7 @@ sed -i "s|\r||" README.md
# We don't need these plugins
%pom_remove_plugin :animal-sniffer-maven-plugin
%pom_remove_plugin :maven-failsafe-plugin
%pom_remove_plugin :maven-jflex-plugin
%pom_remove_plugin :maven-enforcer-plugin
%pom_xpath_set pom:workingDirectory '${basedir}/src/main/java/com/thoughtworks/qdox/parser/impl'
@ -62,20 +65,15 @@ sed -i "s|\r||" README.md
%pom_remove_parent .
%build
# Generate scanners (upstream does this with maven-jflex-plugin)
jflex -d src/main/java/com/thoughtworks/qdox/parser/impl src/grammar/lexer.flex
jflex -d src/main/java/com/thoughtworks/qdox/parser/impl src/grammar/commentlexer.flex
# Generate the parsers using the command-line that the exec-maven-plugin uses
GRAMMAR_PATH=$(pwd)/src/grammar/commentparser.y && \
(cd src/main/java/com/thoughtworks/qdox/parser/impl && \
byaccj -v -Jnorun -Jnoconstruct -Jclass=DefaultJavaCommentParser \
-Jpackage=com.thoughtworks.qdox.parser.impl ${GRAMMAR_PATH})
GRAMMAR_PATH=$(pwd)/src/grammar/parser.y && \
(cd src/main/java/com/thoughtworks/qdox/parser/impl && \
byaccj -v -Jnorun -Jnoconstruct -Jclass=Parser \
-Jimplements=CommentHandler -Jsemantic=Value \
-Jpackage=com.thoughtworks.qdox.parser.impl \
-Jstack=500 ${GRAMMAR_PATH})
# Generate parsers (upstream does this with exec-maven-plugin)
(cd ./src/main/java/com/thoughtworks/qdox/parser/impl
byaccj -v -Jnorun -Jnoconstruct -Jclass=DefaultJavaCommentParser -Jpackage=com.thoughtworks.qdox.parser.impl ../../../../../../../grammar/commentparser.y
byaccj -v -Jnorun -Jnoconstruct -Jclass=Parser -Jimplements=CommentHandler -Jsemantic=Value -Jpackage=com.thoughtworks.qdox.parser.impl -Jstack=500 ../../../../../../../grammar/parser.y
)
# Build artifact
mkdir -p build/classes