Fridrich Strba 2022-04-30 11:20:34 +00:00 committed by Git OBS Bridge
parent dc4eb04c55
commit 6de5f7b7eb
4 changed files with 343 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 4a9fc6a7992e8623956dee6c8cebd0b224968418 Mon Sep 17 00:00:00 2001
From: Zbynek Konecny <zbynek1729@gmail.com>
Date: Wed, 20 Apr 2022 17:01:00 +0200
Subject: [PATCH 1/2] Generate max. one deprecated annotation per method
---
.../resources/templates/gwt/SimpleCharStream.template | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/templates/gwt/SimpleCharStream.template b/src/main/resources/templates/gwt/SimpleCharStream.template
index 9c88437..a1de1e3 100644
--- a/src/main/resources/templates/gwt/SimpleCharStream.template
+++ b/src/main/resources/templates/gwt/SimpleCharStream.template
@@ -215,14 +215,13 @@ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class SimpleCharStream
return c;
}
-#if GENERATE_ANNOTATIONS
- @Deprecated
-#fi
/**
* @deprecated
* @see #getEndColumn
*/
+#if GENERATE_ANNOTATIONS
@Deprecated
+#fi
${PREFIX}public int getColumn() {
#if KEEP_LINE_COLUMN
return bufcolumn[bufpos];
@@ -231,14 +230,13 @@ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class SimpleCharStream
#fi
}
-#if GENERATE_ANNOTATIONS
- @Deprecated
-#fi
/**
* @deprecated
* @see #getEndLine
*/
+#if GENERATE_ANNOTATIONS
@Deprecated
+#fi
${PREFIX}public int getLine() {
#if KEEP_LINE_COLUMN
return bufline[bufpos];
--
2.36.0

View File

@ -0,0 +1,281 @@
From 1e076c05b3739f12fc40e3b652183d770bfcc305 Mon Sep 17 00:00:00 2001
From: Zbynek Konecny <zbynek@geogebra.at>
Date: Mon, 25 Apr 2022 19:17:30 +0200
Subject: [PATCH 2/2] Fix annotations for JavaCharStream
---
pom.xml | 21 ++++-
.../templates/gwt/JavaCharStream.template | 12 ++-
test/gwtTemplate/Parser.jj | 76 +++++++++++++++++++
test/gwtUnicodeTemplate/Parser.jj | 76 +++++++++++++++++++
4 files changed, 175 insertions(+), 10 deletions(-)
create mode 100644 test/gwtTemplate/Parser.jj
create mode 100644 test/gwtUnicodeTemplate/Parser.jj
diff --git a/pom.xml b/pom.xml
index 1f0b371..aedaed9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -310,7 +310,7 @@
<arg line="examples/GUIParsing/ParserVersion/CalcInput.jj" />
</java>
<javac fork="true" srcdir="test.tmp/GUIParsing/ParserVersion" />
- <!--
+ <!--
<echo />
<copy todir="test.tmp/GUIParsing/TokenMgrVersion">
<fileset dir="examples/GUIParsing/TokenMgrVersion">
@@ -318,7 +318,7 @@
</fileset>
</copy>
<java failonerror="true" fork="true" classname="javacc" classpath="target/classes">
- <arg line="-OUTPUT_DIRECTORY=test.tmp/GUIParsing/TokenMgrVersion" />
+ <arg line="-OUTPUT_DIRECTORY=test.tmp/GUIParsing/TokenMgrVersion" />
<arg line="examples/GUIParsing/TokenMgrVersion/CalcInput.jj" />
</java>
<javac fork="true" srcdir="test.tmp/GUIParsing/TokenMgrVersion" />
@@ -554,6 +554,21 @@
<arg line="examples/Obfuscator/MapFile.jj" />
</java>
<javac fork="true" srcdir="test.tmp/Obfuscator" />
+
+ <echo />
+ <java failonerror="true" fork="true" classname="javacc" classpath="target/classes">
+ <arg line="-OUTPUT_DIRECTORY=test.tmp/gwtTemplate" />
+ <arg line="test/gwtTemplate/Parser.jj" />
+ </java>
+ <javac fork="true" srcdir="test.tmp/gwtTemplate" />
+
+ <echo />
+ <java failonerror="true" fork="true" classname="javacc" classpath="target/classes">
+ <arg line="-OUTPUT_DIRECTORY=test.tmp/gwtUnicodeTemplate" />
+ <arg line="test/gwtUnicodeTemplate/Parser.jj" />
+ </java>
+ <javac fork="true" srcdir="test.tmp/gwtUnicodeTemplate" />
+
<!-- TODO, test cases for SimpleExamples -->
<echo />
<copy todir="test.tmp/Transformer">
@@ -647,7 +662,7 @@
</execution>
</executions>
</plugin>
- <!--
+ <!--
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
diff --git a/src/main/resources/templates/gwt/JavaCharStream.template b/src/main/resources/templates/gwt/JavaCharStream.template
index 4433134..ffbcdca 100644
--- a/src/main/resources/templates/gwt/JavaCharStream.template
+++ b/src/main/resources/templates/gwt/JavaCharStream.template
@@ -2,7 +2,7 @@
* An implementation of interface CharStream, where the stream is assumed to
* contain only ASCII characters (with java-like unicode escape processing).
*/
-
+
#if SUPPORT_CLASS_VISIBILITY_PUBLIC
public
@@ -380,14 +380,13 @@ class JavaCharStream
}
}
-#if GENERATE_ANNOTATIONS
- @Deprecated
-#fi
/**
* @deprecated
* @see #getEndColumn
*/
+#if GENERATE_ANNOTATIONS
@Deprecated
+#fi
${PREFIX}public int getColumn() {
#if KEEP_LINE_COLUMN
return bufcolumn[bufpos];
@@ -396,14 +395,13 @@ class JavaCharStream
#fi
}
-#if GENERATE_ANNOTATIONS
- @Deprecated
-#fi
/**
* @deprecated
* @see #getEndLine
*/
+#if GENERATE_ANNOTATIONS
@Deprecated
+#fi
${PREFIX}public int getLine() {
#if KEEP_LINE_COLUMN
return bufline[bufpos];
diff --git a/test/gwtTemplate/Parser.jj b/test/gwtTemplate/Parser.jj
new file mode 100644
index 0000000..e784b4f
--- /dev/null
+++ b/test/gwtTemplate/Parser.jj
@@ -0,0 +1,76 @@
+/* Copyright (c) 2006, Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Sun Microsystems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+options {
+ LOOKAHEAD = 1;
+ CHOICE_AMBIGUITY_CHECK = 2;
+ OTHER_AMBIGUITY_CHECK = 1;
+ STATIC = true;
+ DEBUG_PARSER = false;
+ DEBUG_LOOKAHEAD = false;
+ DEBUG_TOKEN_MANAGER = false;
+ ERROR_REPORTING = true;
+ JAVA_UNICODE_ESCAPE = false;
+ UNICODE_INPUT = false;
+ IGNORE_CASE = false;
+ USER_TOKEN_MANAGER = false;
+ USER_CHAR_STREAM = false;
+ BUILD_PARSER = true;
+ BUILD_TOKEN_MANAGER = true;
+ SANITY_CHECK = true;
+ FORCE_LA_CHECK = false;
+ JAVA_TEMPLATE_TYPE = "modern";
+}
+
+PARSER_BEGIN(Parser)
+
+import java.io.IOException;
+
+/** Simple brace matcher. */
+public class Parser {
+
+ /** Main entry point. */
+ public static void main(String args[]) throws ParseException, IOException {
+ Parser parser = new Parser(new StreamProvider(System.in));
+ parser.Input();
+ }
+
+}
+
+PARSER_END(Parser)
+
+/** Root production. */
+void Input() :
+{}
+{
+
+ "A" {
+ System.out.println("hello");
+ } <EOF>
+}
diff --git a/test/gwtUnicodeTemplate/Parser.jj b/test/gwtUnicodeTemplate/Parser.jj
new file mode 100644
index 0000000..4847e08
--- /dev/null
+++ b/test/gwtUnicodeTemplate/Parser.jj
@@ -0,0 +1,76 @@
+/* Copyright (c) 2006, Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Sun Microsystems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+options {
+ LOOKAHEAD = 1;
+ CHOICE_AMBIGUITY_CHECK = 2;
+ OTHER_AMBIGUITY_CHECK = 1;
+ STATIC = true;
+ DEBUG_PARSER = false;
+ DEBUG_LOOKAHEAD = false;
+ DEBUG_TOKEN_MANAGER = false;
+ ERROR_REPORTING = true;
+ JAVA_UNICODE_ESCAPE = true;
+ UNICODE_INPUT = false;
+ IGNORE_CASE = false;
+ USER_TOKEN_MANAGER = false;
+ USER_CHAR_STREAM = false;
+ BUILD_PARSER = true;
+ BUILD_TOKEN_MANAGER = true;
+ SANITY_CHECK = true;
+ FORCE_LA_CHECK = false;
+ JAVA_TEMPLATE_TYPE = "modern";
+}
+
+PARSER_BEGIN(Parser)
+
+import java.io.IOException;
+
+/** Simple brace matcher. */
+public class Parser {
+
+ /** Main entry point. */
+ public static void main(String args[]) throws ParseException, IOException {
+ Parser parser = new Parser(new StreamProvider(System.in));
+ parser.Input();
+ }
+
+}
+
+PARSER_END(Parser)
+
+/** Root production. */
+void Input() :
+{}
+{
+
+ "A" {
+ System.out.println("hello");
+ } <EOF>
+}
--
2.36.0

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sat Apr 30 11:17:17 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Added patches:
* 0001-Generate-max.-one-deprecated-annotation-per-method.patch
* 0002-Fix-annotations-for-JavaCharStream.patch
+ Fix regression where duplicate @Deprecated annotations were
generated
-------------------------------------------------------------------
Wed Apr 27 17:08:11 UTC 2022 - Anton Shvetz <shvetz.anton@gmail.com>

View File

@ -31,6 +31,8 @@ License: BSD-3-Clause
Group: Development/Libraries/Java
URL: https://javacc.org
Source0: https://github.com/javacc/javacc/archive/refs/tags/%{base_name}-%{version}.tar.gz
Patch0: 0001-Generate-max.-one-deprecated-annotation-per-method.patch
Patch1: 0002-Fix-annotations-for-JavaCharStream.patch
BuildRequires: ant
BuildRequires: java-devel >= 1.8
BuildArch: noarch
@ -82,7 +84,7 @@ Group: Documentation/HTML
This package contains the API documentation for %{name}.
%prep
%autosetup -n %{base_name}-%{base_name}-%{version}
%autosetup -n %{base_name}-%{base_name}-%{version} -p1
rm -f lib/*.jar
%if %{without bootstrap}
rm -f bootstrap/javacc.jar