Fix build with JDK11

This commit is contained in:
Mikolaj Izdebski 2019-11-05 11:09:43 +01:00
parent 52b30dff98
commit 6f8d07e3f6
4 changed files with 92 additions and 297 deletions

View File

@ -1,131 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.xerces.util;
import java.util.Map;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.Taglet;
/**
* This class provides support for a 'xerces.experimental' tag
* in javadoc comments. The tag creates a warning in the generated
* html for users.
*
* @author Ankit Pasricha, IBM
*/
public class ExperimentalTaglet implements Taglet {
private static final String NAME = "xerces.experimental";
private static final String HEADER = "EXPERIMENTAL:";
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inConstructor()
*/
public boolean inConstructor() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inField()
*/
public boolean inField() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inMethod()
*/
public boolean inMethod() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inOverview()
*/
public boolean inOverview() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inPackage()
*/
public boolean inPackage() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inType()
*/
public boolean inType() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#isInlineTag()
*/
public boolean isInlineTag() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#getName()
*/
public String getName() {
return NAME;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag)
*/
public String toString(Tag arg0) {
return "<DT><H1 style=\"font-size:150%\">" + HEADER + "</H1><DD>"
+ "This class should not be considered stable. It is likely to be altered or replaced in the future.<br/>"
+ "<I>" + arg0.text() + "</I></DD>\n";
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag[])
*/
public String toString(Tag[] tags) {
if (tags.length == 0) {
return null;
}
String result = "\n<DT><H1 style=\"font-size:150%\">" + HEADER + "</H1><DD>";
result += "This class should not be considered stable. It is likely to be altered or replaced in the future.";
result += "<I>";
for (int i = 0; i < tags.length; i++) {
result += "<br/>";
result += tags[i].text();
}
return result + "</I></DD>\n";
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
ExperimentalTaglet tag = new ExperimentalTaglet();
Taglet t = (Taglet) tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
}

View File

@ -1,131 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.xerces.util;
import java.util.Map;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.Taglet;
/**
* This class provides support for a 'xerces.internal' tag
* in javadoc comments. The tag creates a warning in the generated
* html for users.
*
* @author Ankit Pasricha, IBM
*/
public class InternalTaglet implements Taglet {
private static final String NAME = "xerces.internal";
private static final String HEADER = "INTERNAL:";
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inConstructor()
*/
public boolean inConstructor() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inField()
*/
public boolean inField() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inMethod()
*/
public boolean inMethod() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inOverview()
*/
public boolean inOverview() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inPackage()
*/
public boolean inPackage() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#inType()
*/
public boolean inType() {
return true;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#isInlineTag()
*/
public boolean isInlineTag() {
return false;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#getName()
*/
public String getName() {
return NAME;
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag)
*/
public String toString(Tag arg0) {
return "<DT><H1 style=\"font-size:110%\">" + HEADER + "</H1><DD>"
+ "Usage of this class is not supported. It may be altered or removed at any time.<br/>"
+ "<I>" + arg0.text() + "</I></DD>\n";
}
/* (non-Javadoc)
* @see com.sun.tools.doclets.Taglet#toString(com.sun.javadoc.Tag[])
*/
public String toString(Tag[] tags) {
if (tags.length == 0) {
return null;
}
String result = "\n<DT><H1 style=\"font-size:110%\">" + HEADER + "</H1><DD>";
result += "Usage of this class is not supported. It may be altered or removed at any time.";
result += "<I>";
for (int i = 0; i < tags.length; i++) {
result += "<br/>";
result += tags[i].text();
}
return result + "</I></DD>\n";
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
InternalTaglet tag = new InternalTaglet();
Taglet t = (Taglet) tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
}

84
getContentDocument.patch Normal file
View File

@ -0,0 +1,84 @@
From: Markus Koschany <apo@debian.org>
Date: Sat, 12 May 2018 22:12:44 +0200
Subject: getContentDocument
Fix FTBFS with Java10 due to missing method getContentDocument.
Forwarded: no
---
src/org/apache/html/dom/HTMLFrameElementImpl.java | 7 +++++++
src/org/apache/html/dom/HTMLIFrameElementImpl.java | 5 +++++
src/org/apache/html/dom/HTMLObjectElementImpl.java | 5 +++++
3 files changed, 17 insertions(+)
diff --git a/src/org/apache/html/dom/HTMLFrameElementImpl.java b/src/org/apache/html/dom/HTMLFrameElementImpl.java
index 18ab953..e90a592 100644
--- a/src/org/apache/html/dom/HTMLFrameElementImpl.java
+++ b/src/org/apache/html/dom/HTMLFrameElementImpl.java
@@ -17,6 +17,8 @@
package org.apache.html.dom;
import org.w3c.dom.html.HTMLFrameElement;
+import org.w3c.dom.Document;
+
/**
* @xerces.internal
@@ -127,6 +129,11 @@ public class HTMLFrameElementImpl
setAttribute( "src", src );
}
+ public Document getContentDocument()
+ {
+ return null;
+ }
+
/**
* Constructor requires owner document.
diff --git a/src/org/apache/html/dom/HTMLIFrameElementImpl.java b/src/org/apache/html/dom/HTMLIFrameElementImpl.java
index c326557..287ba9e 100644
--- a/src/org/apache/html/dom/HTMLIFrameElementImpl.java
+++ b/src/org/apache/html/dom/HTMLIFrameElementImpl.java
@@ -17,6 +17,7 @@
package org.apache.html.dom;
import org.w3c.dom.html.HTMLIFrameElement;
+import org.w3c.dom.Document;
/**
* @xerces.internal
@@ -150,6 +151,10 @@ public class HTMLIFrameElementImpl
setAttribute( "width", width );
}
+ public Document getContentDocument()
+ {
+ return null;
+ }
/**
* Constructor requires owner document.
diff --git a/src/org/apache/html/dom/HTMLObjectElementImpl.java b/src/org/apache/html/dom/HTMLObjectElementImpl.java
index b065e69..cd27fc8 100644
--- a/src/org/apache/html/dom/HTMLObjectElementImpl.java
+++ b/src/org/apache/html/dom/HTMLObjectElementImpl.java
@@ -17,6 +17,7 @@
package org.apache.html.dom;
import org.w3c.dom.html.HTMLObjectElement;
+import org.w3c.dom.Document;
/**
* @xerces.internal
@@ -239,6 +240,10 @@ public class HTMLObjectElementImpl
setAttribute( "width", width );
}
+ public Document getContentDocument()
+ {
+ return null;
+ }
/**

View File

@ -22,10 +22,6 @@ Source12: %{name}-constants.1
# Custom javac ant task used by the build
Source3: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_%{cvs_version}/tools/src/XJavac.java
# Custom doclet tags used in javadocs
Source5: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_%{cvs_version}/tools/src/ExperimentalTaglet.java
Source6: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_%{cvs_version}/tools/src/InternalTaglet.java
Source7: %{name}-pom.xml
# Patch the build so that it doesn't try to use bundled xml-commons source
@ -34,6 +30,9 @@ Patch0: %{name}-build.patch
# Patch the manifest so that it includes OSGi stuff
Patch1: %{name}-manifest.patch
# Fix FTBFS with Java10 due to missing method getContentDocument
Patch2: https://sources.debian.org/data/main/libx/libxerces2-java/2.12.0-1/debian/patches/getContentDocument.patch
BuildArch: noarch
BuildRequires: javapackages-local
@ -85,14 +84,6 @@ also handles name spaces according to the XML Namespaces 1.1 Recommendation,
and will correctly serialize XML 1.1 documents if the DOM level 3 load/save
APIs are in use.
%package javadoc
Summary: Javadocs for %{name}
# Consolidating all javadocs into one package
%description javadoc
This package contains the API documentation for %{name}.
%package demo
Summary: Demonstrations and samples for %{name}
Requires: %{name} = %{version}-%{release}
@ -104,11 +95,12 @@ Requires: %{name} = %{version}-%{release}
%setup -q -n xerces-%{cvs_version}
%patch0 -p0 -b .orig
%patch1 -p0 -b .orig
%patch2 -p1
# Copy the custom ant tasks into place
mkdir -p tools/org/apache/xerces/util
mkdir -p tools/bin
cp -a %{SOURCE3} %{SOURCE5} %{SOURCE6} tools/org/apache/xerces/util
cp -a %{SOURCE3} tools/org/apache/xerces/util
# Make sure upstream hasn't sneaked in any jars we don't know about
find -name '*.class' -exec rm -f '{}' \;
@ -127,10 +119,6 @@ pushd tools
javac -classpath $(build-classpath ant) org/apache/xerces/util/XJavac.java
jar cf bin/xjavac.jar org/apache/xerces/util/XJavac.class
# Build custom doc taglets
javac -classpath /usr/lib/jvm/java/lib/tools.jar org/apache/xerces/util/*Taglet.java
jar cf bin/xerces2taglets.jar org/apache/xerces/util/*Taglet.class
ln -sf $(build-classpath xalan-j2-serializer) serializer.jar
ln -sf $(build-classpath xml-commons-apis) xml-apis.jar
ln -sf $(build-classpath xml-commons-resolver) resolver.jar
@ -138,28 +126,16 @@ ln -sf $(build-classpath xerces-j2) x.jar
popd
# Build everything
export ANT_OPTS="-Xmx256m -Djava.endorsed.dirs=$(pwd)/tools -Djava.awt.headless=true -Dbuild.sysclasspath=first -Ddisconnected=true"
ant -Djavac.source=1.5 -Djavac.target=1.5 \
export ANT_OPTS="-Xmx256m -Djava.awt.headless=true -Dbuild.sysclasspath=first -Ddisconnected=true"
ant -Djavac.source=1.6 -Djavac.target=1.6 \
-Dbuild.compiler=modern \
clean jars javadocs
clean jars
%mvn_artifact %{SOURCE7} build/xercesImpl.jar
%install
%mvn_install
# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}
mkdir -p %{buildroot}%{_javadocdir}/%{name}/impl
mkdir -p %{buildroot}%{_javadocdir}/%{name}/xs
mkdir -p %{buildroot}%{_javadocdir}/%{name}/xni
mkdir -p %{buildroot}%{_javadocdir}/%{name}/other
cp -pr build/docs/javadocs/xerces2/* %{buildroot}%{_javadocdir}/%{name}/impl
cp -pr build/docs/javadocs/api/* %{buildroot}%{_javadocdir}/%{name}/xs
cp -pr build/docs/javadocs/xni/* %{buildroot}%{_javadocdir}/%{name}/xni
cp -pr build/docs/javadocs/other/* %{buildroot}%{_javadocdir}/%{name}/other
# scripts
install -pD -m755 -T %{SOURCE1} %{buildroot}%{_bindir}/%{name}-version
install -pD -m755 -T %{SOURCE2} %{buildroot}%{_bindir}/%{name}-constants
@ -184,9 +160,6 @@ ln -sf %{name}.jar %{_javadir}/jaxp_parser_impl.jar
%{_bindir}/*
%{_mandir}/*/*
%files javadoc
%{_javadocdir}/%{name}
%files demo
%{_datadir}/%{name}