[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-distro-pkg-dev
Subject:    Re: java-atk-wrapper accessibility and openjdk9
From:       Fridrich Strba <fridrich.strba () suse ! com>
Date:       2017-10-26 8:35:52
Message-ID: e7fe727c-15a9-ee35-6a99-3c8c761a000a () suse ! com
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]

[Attachment #4 (multipart/mixed)]


OK, with the attached patch, the java-atk-wrapper is loaded using the
javax.accessibility.AccessibilityProvider service.

I also modified the required java version in the configure.ac, since
source level 6 cannot be use because of "Hash<>" in the code.

It would be still good condition the compilation of the AtkProvider.java
to the fact one is compiling with java9, since the extended class was
introduced in java 9.

As I said, with this patch the provider is activated with
loadAssistiveTechnologies without having to go to the
fallbackToLoadClassForAT. But, at the end of the day, both bring us to
the same result, the java-atk-wrapper being loaded.

I gave a little thought to the approach of making this a module and
include it in the jdk, but that would mean basically to have distributed
also the libjava-atk-wrapper.so, which would mean the whole package
depending on the Gnome atk stack including gdk and glib. Not something
that would one really want, IMHO.

Cheers

F.

On 26/10/17 09:40, Fridrich Strba wrote:
> Good people,
> 
> On 26/10/17 08:40, Fridrich Strba wrote:
>> It looks like the java-atk-wrapper has to implement the
>> https://docs.oracle.com/javase/9/docs/api/javax/accessibility/AccessibilityProvider.html
>>
>> Which, in my understanding means implementing two methods: getName and
>> activate. Not sure whether creating a new class that implements those
>> two methods and where the activate method loads the AtkWrapper class
>> should be enough.
> 
> Actually reading the code in java.awt.Toolkit, I realize that
> java-atk-wrapper as it is now can work. For any class that is declared
> as assistive_technologies and does not implement the
> AccessibilityProvider, the java.awt.Toolkit has a static method
> fallbackToLoadClassForAT which loads happily the AtkWrapper with the
> class name from our java-atk-wrapper.jar.
> 
> So, this solution, although maybe not as elegant as that, could work.
> 
> Cheers
> 
> Fridrich
> 
> P.S.: It is always possible to implement the AccessibilityProvider by
> dropping the attached file to the wrapper/org/GNOME/Accessibility/
> directory and also craft inside the JAR file a
> META-INF/services/javax.accessibility.AccessibilityProvider with content
> "org.GNOME
> .Accessibility.AtkWrapper"
> 


["jaw-java9.patch" (text/x-patch)]

--- java-atk-wrapper-0.33.2/configure.ac	2015-07-07 13:52:28.000000000 +0200
+++ java-atk-wrapper-0.33.2/configure.ac	2017-10-26 10:22:52.392980642 +0200
@@ -64,7 +64,7 @@
 # java wrapper
 
 AM_CONDITIONAL(USER, test `whoami` = "root")
-JAVA_REQUIRED=1.6
+JAVA_REQUIRED=1.7
 JAVA_ERROR_MESSAGE="Java $JAVA_REQUIRED or later is required to build \
java-access-bridge"  
 AC_ARG_VAR([JAVA_HOME],[Java Runtime Environment location])
@@ -169,6 +169,8 @@
     wrapper/org/Makefile
     wrapper/org/GNOME/Makefile
     wrapper/org/GNOME/Accessibility/Makefile
+    wrapper/META-INF/Makefile
+    wrapper/META-INF/services/Makefile
 ])
 AC_OUTPUT
 
--- java-atk-wrapper-0.33.2/wrapper/Makefile.am	2015-07-01 02:19:15.000000000 +0200
+++ java-atk-wrapper-0.33.2/wrapper/Makefile.am	2017-10-26 09:52:31.975134568 +0200
@@ -1,4 +1,4 @@
-SUBDIRS=org
+SUBDIRS=org META-INF
 JARFILES=java-atk-wrapper.jar
 ALL_CLASSES=org/GNOME/Accessibility/*.class
 DEP_CLASSES=$(wildcard $(ALL_CLASSES))
@@ -16,7 +16,7 @@
 EXTRA_DIST = $(properties_DATA)
 
 $(JARFILES) : $(DEP_CLASSES)
-	$(JAR) cfm $(JARFILES) manifest.txt org/GNOME/Accessibility/*.class
+	$(JAR) cfm $(JARFILES) manifest.txt org/GNOME/Accessibility/*.class \
META-INF/services/javax.accessibility.AccessibilityProvider  
 all-local : $(DATA) $(JARFILES)
 
--- java-atk-wrapper-0.33.2/wrapper/META-INF/Makefile.am	1970-01-01 \
                01:00:00.000000000 +0100
+++ java-atk-wrapper-0.33.2/wrapper/META-INF/Makefile.am	2017-10-26 \
09:49:21.065016976 +0200 @@ -0,0 +1 @@
+SUBDIRS=services
--- java-atk-wrapper-0.33.2/wrapper/META-INF/services/javax.accessibility.AccessibilityProvider	1970-01-01 \
                01:00:00.000000000 +0100
+++ java-atk-wrapper-0.33.2/wrapper/META-INF/services/javax.accessibility.AccessibilityProvider	2017-10-26 \
10:10:26.020630093 +0200 @@ -0,0 +1 @@
+org.GNOME.Accessibility.AtkProvider
--- java-atk-wrapper-0.33.2/wrapper/META-INF/services/Makefile.am	1970-01-01 \
                01:00:00.000000000 +0100
+++ java-atk-wrapper-0.33.2/wrapper/META-INF/services/Makefile.am	2017-10-26 \
09:50:22.463134079 +0200 @@ -0,0 +1 @@
+EXTRA_DIST = javax.accessibility.AccessibilityProvider
--- java-atk-wrapper-0.33.2/wrapper/org/GNOME/Accessibility/AtkProvider.java	1970-01-01 \
                01:00:00.000000000 +0100
+++ java-atk-wrapper-0.33.2/wrapper/org/GNOME/Accessibility/AtkProvider.java	2017-10-26 \
09:58:25.508202770 +0200 @@ -0,0 +1,39 @@
+/*
+ * Java ATK Wrapper for GNOME
+ * Copyright (C) Oracle and/or its affiliates.
+ * Copyright (C) 2017 Fridrich Strba <fridrich.strba@bluewin.ch>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+package org.GNOME.Accessibility;
+
+import javax.accessibility.AccessibilityProvider;
+import org.GNOME.Accessibility.AtkWrapper;
+
+public final class AtkProvider extends AccessibilityProvider {
+    private final String name = "org.GNOME.Accessibility.AtkWrapper";
+
+    public AtkProvider() {}
+
+    public String getName() {
+        return name;
+    }
+
+    public void activate() {
+        new AtkWrapper();
+    }
+
+}
--- java-atk-wrapper-0.33.2/wrapper/org/GNOME/Accessibility/Makefile.am	2015-06-30 \
                23:56:32.000000000 +0200
+++ java-atk-wrapper-0.33.2/wrapper/org/GNOME/Accessibility/Makefile.am	2017-10-26 \
10:18:40.284451824 +0200 @@ -10,7 +10,7 @@
 	sed -e "s;\@XPROP\@;${XPROP};g" \
 		< $< >$@
 
-%.class : %.java
+%.class : %.java AtkWrapper.java
 	CLASSPATH=$(top_srcdir)/wrapper $(JAVAC) $(JAVACFLAGS) -d $(top_builddir)/wrapper \
$<  
 clean-local:


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic