Fix build with jdk9

OBS-URL: https://build.opensuse.org/package/show/Java:packages/xpp2?expand=0&rev=11
This commit is contained in:
Fridrich Strba 2017-09-11 16:48:01 +00:00 committed by Git OBS Bridge
parent 23e2b6af72
commit aa7b3ab315
4 changed files with 94 additions and 5 deletions

View File

@ -5,8 +5,8 @@
- <property name="target" value="1.1" />
+ <property name="target" value="1.4" />
+ <property name="source" value="1.4" />
+ <property name="target" value="1.6" />
+ <property name="source" value="1.6" />
<!-- set global properties for this build -->
<property name="name" value="XML Pull Parser"/>
@ -185,7 +185,7 @@
<javadoc packagenames="${apidoc_packages}"
sourcepath="${src_intf}"
destdir="${build_apidoc}"
+ source="1.4"
+ source="1.6"
author="true"
version="true"
use="true"
@ -193,7 +193,7 @@
<javadoc packagenames="${javadoc_packages}"
sourcepath="${src_intf}:${src_impl_factory}:${src_impl_small}:${src_impl_tag}:${src_impl_pp}:${src_impl_node}:${src_impl_format}:${src_x2impl}:${src_x2impl_factory}:${src_x2impl_pp}"
destdir="${build_javadoc}"
+ source="1.4"
+ source="1.6"
author="true"
version="true"
use="true"

76
xpp2-enum.patch Normal file
View File

@ -0,0 +1,76 @@
--- PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/node/Node.java 2017-09-11 18:39:27.105544537 +0200
+++ PullParser2.1.10/src/java/impl/node/org/gjt/xpp/impl/node/Node.java 2017-09-11 18:41:06.771360115 +0200
@@ -273,9 +273,9 @@
oneChild = null;
if(children != null && children.size() > 0) {
- Enumeration enum = children.elements();
- while (enum.hasMoreElements()) {
- Object child = enum.nextElement();
+ Enumeration emun = children.elements();
+ while (emun.hasMoreElements()) {
+ Object child = emun.nextElement();
if(child instanceof XmlNode) {
((XmlNode)child).setParentNode(null);
}
@@ -373,11 +373,11 @@
if(declaredNs != null) {
System.arraycopy(declaredNs, 0, uris, off, len);
}
- // Enumeration enum = prefix2Ns.keys();
+ // Enumeration emun = prefix2Ns.keys();
// int i = off;
- // while (enum.hasMoreElements() && i < off + len)
+ // while (emun.hasMoreElements() && i < off + len)
// {
- // uris[i++] = (String) prefix2Ns.get( enum.nextElement() );
+ // uris[i++] = (String) prefix2Ns.get( emun.nextElement() );
// }
}
@@ -512,10 +512,10 @@
buf.append(declaredNs[i]);
buf.append("'");
}
- // Enumeration enum = prefix2Ns.keys();
- // while (enum.hasMoreElements())
+ // Enumeration emun = prefix2Ns.keys();
+ // while (emun.hasMoreElements())
// {
- // Object key = enum.nextElement();
+ // Object key = emun.nextElement();
// buf.append("xmlns:");
// buf.append(key);
// buf.append("='");
--- PullParser2.1.10/src/java/tests/node/NodeTest.java 2017-09-11 18:39:27.109544537 +0200
+++ PullParser2.1.10/src/java/tests/node/NodeTest.java 2017-09-11 18:43:53.211362957 +0200
@@ -386,20 +386,20 @@
assertEquals("", t1.getDefaultNamespaceUri());
// check enumeration stuff...
- Enumeration enum = t1.children();
+ Enumeration emun = t1.children();
assertEquals(0, t1.getChildrenCountSoFar());
//child1, child2...
- assertTrue(enum.hasMoreElements());
- child1 = (XmlPullNode) enum.nextElement();
+ assertTrue(emun.hasMoreElements());
+ child1 = (XmlPullNode) emun.nextElement();
assertEquals("child1", child1.getLocalName());
- assertNotNull(enum.nextElement());
- child3 = (XmlPullNode) enum.nextElement();
+ assertNotNull(emun.nextElement());
+ child3 = (XmlPullNode) emun.nextElement();
assertEquals("child3", child3.getLocalName());
- assertNotNull(enum.nextElement());
+ assertNotNull(emun.nextElement());
assertEquals(4, t1.getChildrenCountSoFar());
- assertEquals(true, enum.hasMoreElements());
- assertNotNull(enum.nextElement());
- assertEquals(false, enum.hasMoreElements());
+ assertEquals(true, emun.hasMoreElements());
+ assertNotNull(emun.nextElement());
+ assertEquals(false, emun.hasMoreElements());
XmlPullNode t2 = (XmlPullNode) node.getChildAt(1);
assertEquals("t2", t2.getLocalName());

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Sep 11 16:45:34 UTC 2017 - fstrba@suse.com
- Modified patch:
* xpp2-build_xml.patch
+ Specify java source and target level 1.6 in order to allow
building with jdk9
* xpp2-enum.patch
+ Rename variables "enum" to "emun" in order to avoid clash
with a reserved word in java >= 1.5
-------------------------------------------------------------------
Fri Jul 11 13:59:37 UTC 2014 - tchvatal@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package xpp2
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,6 +26,7 @@ Group: Development/Libraries/Java
Url: http://www.extreme.indiana.edu/xgws/xsoap/xpp/
Source0: http://www.extreme.indiana.edu/xgws/xsoap/xpp/download/PullParser2/PullParser2.1.10.tar.bz2
Patch0: xpp2-build_xml.patch
Patch1: xpp2-enum.patch
BuildRequires: ant >= 1.6
BuildRequires: ant-junit >= 1.6
BuildRequires: fdupes
@ -74,6 +75,7 @@ active development concentrates on its successor XPP3/MXP1
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
%patch0 -b .sav
%patch1 -p1
%build
export OPT_JAR_LIST="ant/ant-junit junit"