-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove java.desktop dependency from javax.xml.
The only dependency to java.desktop was coming from JAXB.java where a 25 line method from java.beans.Introspector was used to decapitalize a Java class name. Partly fixes #7502. This works around #6799 which seems to take longer than expected because there is some implementation work left to do. RELNOTES: None Partial commit for third_party/*, see #8066. Signed-off-by: Philipp Wollermann <philwo@google.com>
- Loading branch information
Showing
4 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff -ur srcs/javax/xml/bind/JAXB.java srcs-patched/javax/xml/bind/JAXB.java | ||
--- srcs/javax/xml/bind/JAXB.java 2018-09-12 06:26:24.000000000 +0200 | ||
+++ srcs-patched/javax/xml/bind/JAXB.java 2019-04-16 17:17:25.118768524 +0200 | ||
@@ -46,7 +46,6 @@ | ||
import javax.xml.transform.Source; | ||
import javax.xml.transform.stream.StreamResult; | ||
import javax.xml.transform.stream.StreamSource; | ||
-import java.beans.Introspector; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
@@ -593,7 +592,30 @@ | ||
} | ||
|
||
private static String inferName(Class clazz) { | ||
- return Introspector.decapitalize(clazz.getSimpleName()); | ||
+ String name = clazz.getSimpleName(); | ||
+ try { | ||
+ if (!Character.isUpperCase(name.charAt(0))) { | ||
+ return name; | ||
+ } else { | ||
+ try { | ||
+ if(Character.isUpperCase(name.charAt(1))) { | ||
+ return name; | ||
+ } else { | ||
+ char[] c = name.toCharArray(); | ||
+ c[0] = Character.toLowerCase(c[0]); | ||
+ return new String(c); | ||
+ } | ||
+ } catch(StringIndexOutOfBoundsException E) { | ||
+ char[] c = new char[1]; | ||
+ c[0] = Character.toLowerCase(name.charAt(0)); | ||
+ return new String(c); | ||
+ } | ||
+ } | ||
+ } catch(StringIndexOutOfBoundsException E) { | ||
+ return name; | ||
+ } catch(NullPointerException E) { | ||
+ return null; | ||
+ } | ||
} | ||
|
||
/** | ||
diff -ur srcs/module-info.java srcs-patched/module-info.java | ||
--- srcs/module-info.java 2018-09-12 06:26:24.000000000 +0200 | ||
+++ srcs-patched/module-info.java 2019-04-16 17:17:16.038792433 +0200 | ||
@@ -42,7 +42,6 @@ | ||
requires transitive java.activation; | ||
requires transitive java.xml; | ||
requires java.logging; | ||
- requires java.desktop; | ||
|
||
exports javax.xml.bind; | ||
exports javax.xml.bind.annotation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
mkdir srcs | ||
cd srcs | ||
jar xvf ../jaxb-api-2.3.1-sources.jar | ||
patch -p1 < ../remove-java.desktop.patch | ||
rm -rf META-INF | ||
find . -type f -name \*.java -print0 | xargs -0 javac | ||
find . -type f -name \*.class -print0 | xargs -0 jar -cvf ../jaxb-api-2.3.1-patched.jar |