Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8256109: Create implementation for NSAccessibilityButton protocol #1549

Closed
wants to merge 16 commits into from

Conversation

@azuev-java
Copy link
Member

@azuev-java azuev-java commented Dec 1, 2020

Creating a native peer for pushbutton accessibility role on Max OS X.
The process of choosing of what peer to initialize is clunky so
might be addressed in the future.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8256109: Create implementation for NSAccessibilityButton protocol

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1549/head:pull/1549
$ git checkout pull/1549

azuev-java added 6 commits Oct 19, 2020
Merge changes from master
Initial implementation. In future the accessibilityLabel function might
be moved to a common component accessibility level if during
implementation i will not find any corner cases when this function
should behave radically different.
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Dec 1, 2020

👋 Welcome back kizune! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Dec 1, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Dec 1, 2020

@azuev-java The following label will be automatically applied to this pull request:

  • awt

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the awt label Dec 1, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Dec 1, 2020

@mrserb
Copy link
Member

@mrserb mrserb commented Dec 4, 2020

Maybe it is better to change the used file hierarchy? So all new native a11y could be placed in a separate folder and each peer in a separate file? It will be hard to understand the code if will have old and new implementation just in one file for all peers, actually, even now it is hard to view this file containing all old code.

/*
* Implementation of the NSAccessibilityButton protocol
*/
@implementation ButtonAccessibility

This comment has been minimized.

@mrserb

mrserb Dec 4, 2020
Member

Do not we need to remove the old perform()?

This comment has been minimized.

@azuev-java

azuev-java Dec 16, 2020
Author Member

Not yet - as i said i'm not going to delete the old code yet si it can be easily reverted for testing and comparison reasons.

AWT_ASSERT_APPKIT_THREAD;

JNIEnv* env = [ThreadUtilities getJNIEnv];
JNFCallStaticVoidMethod(env, jm_doAccessibleAction, [self axContextWithEnv:(env)], 0, fComponent);

This comment has been minimized.

@mrserb

mrserb Dec 4, 2020
Member

Are you sure that the jm_doAccessibleAction is always initialized here?

This comment has been minimized.

@azuev-java

azuev-java Dec 16, 2020
Author Member

Yes.

This comment has been minimized.

@mrserb

mrserb Dec 18, 2020
Member

I guess it is became broken when the perform() will be removed. Can this method use its own variable?

azuev-java added 2 commits Dec 14, 2020
Changed the iitialization procedure to a class function with
dictionary of role to class name relation.

This pr is still intermittent since it uses the old style
JNF java call syntacsis. Once fix for JDK-8257853 is integrated
the calls needs to be converted to the new style but that is a minor
change.
@azuev-java
Copy link
Member Author

@azuev-java azuev-java commented Dec 16, 2020

Maybe it is better to change the used file hierarchy?

That probably a good idea. Uploading a new fix version.

@prrace
prrace approved these changes Dec 16, 2020
Copy link
Contributor

@prrace prrace left a comment

All looks fine to me, although it will hit the changes to remove JNF for JNI calls in a head-on conflict.

@openjdk
Copy link

@openjdk openjdk bot commented Dec 16, 2020

@azuev-java This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8256109: Create implementation for NSAccessibilityButton protocol

Reviewed-by: prr, serb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 54 new commits pushed to the master branch:

  • 5513f98: 8258010: Debug build failure with clang-10 due to -Wdeprecated-copy
  • 51e14f2: Merge
  • 5926d75: 8259719: ProblemList runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java on Windows
  • 8abefde: 8259720: ProblemList java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.java on Windows
  • fb8ac24: 8259722: ProblemList two jdk/jfr/startupargs tests on Windows
  • ac4cd2e: 8231461: static/instance overload leads to 'unexpected static method found in unbound lookup' when resolving method reference
  • 42d2d6d: 8259063: Possible deadlock with vtable/itable creation vs concurrent class unloading
  • 6bb6093: 8259657: typo in generated HELP page prevents localization
  • 5567530: 8258272: LoadVectorMaskedNode can't be replaced by zero con
  • a99df45: 8259560: Zero m68k: "static assertion failed: align" after JDK-8252049
  • ... and 44 more: https://git.openjdk.java.net/jdk/compare/77f6290995dc681c55301fd032f642057523094a...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Dec 16, 2020
- (nullable id)accessibilityParent;
@end

#endif

This comment has been minimized.

@pankaj-bansal

pankaj-bansal Dec 17, 2020

I see a warning for missing newline at end of this file.

This comment has been minimized.

@azuev-java

azuev-java Jan 12, 2021
Author Member

For some reason all .h files are marked with this warning. Not sure why - there are no new line after the last statements in other .h files in the project.

* or visit www.oracle.com if you need additional information or have any
* questions.
*/

This comment has been minimized.

@pankaj-bansal

pankaj-bansal Dec 17, 2020

There are no header guard here. Is it left intentionally?

This comment has been minimized.

@azuev-java

azuev-java Jan 12, 2021
Author Member

Yes, since the CommonComponentAccessibility being imported from the base class sometimes it causes compilation glitches - guess ObjC is not a big fan of forward-declaration. Adding header guard helps. And since i'm not planning to include sub-component header files in the base classes the ifdef guard is not required.

This comment has been minimized.

@mrserb

mrserb Jan 13, 2021
Member

The headers in the obj-c usually do not have guards because they are included via "#import"

This comment has been minimized.

@azuev-java

azuev-java Jan 13, 2021
Author Member

I know. But in this case that was not enough - that still caused weird compilation glitches like full compilation works but incremental calculation gives compilation error about usage of non-initialized variables. Guards helped.

This comment has been minimized.

@mrserb

mrserb Jan 13, 2021
Member

I missed where the guards have helped, there are no guards in this file.
Same question about why did you add guards to the "CommonComponentAccessibility.h"?

This comment has been minimized.

@azuev-java

azuev-java Jan 13, 2021
Author Member

I added guards into CommonComponentAccessibility.h because without them importing them into JavaComponentAccessibility from which CommonComponentAccessibility is inherited creates intermittent build failures. I used ifdef guards and the problem was gone so i kept them. I do not include any of the implementing classes headers down the inheritance three so i decided not to add guards there.

@pankaj-bansal
Copy link

@pankaj-bansal pankaj-bansal commented Dec 17, 2020

@azuev-java I think you need to rebase this PR as you started working on this some time back. If I use "git fetch #1549" to get the PR, I need to Reconfigure, though there is no makefile changes done. Also, it is resulting in failure if configure. There are few merge commits in this PR, may be that is the issue.
When I just apply the PR with https://github.com/openjdk/jdk/pull/1549.diff, it works fine, so the actual code changes are fine.

* questions.
*/

#include "ButtonAccessibility.h"

This comment has been minimized.

@mrserb

mrserb Dec 18, 2020
Member

I guess we should be consistent in the usage of import vs include.

This comment has been minimized.

@azuev-java

azuev-java Jan 12, 2021
Author Member

You are not wrong. Fixed.

#include "ButtonAccessibility.h"
#import "ThreadUtilities.h"

static JNF_STATIC_MEMBER_CACHE(jm_doAccessibleAction, sjc_CAccessibility,"doAccessibleAction","(Ljavax/accessibility/AccessibleAction;ILjava/awt/Component;)V");

This comment has been minimized.

@mrserb

mrserb Dec 18, 2020
Member

You can move this to the method itself, it is unlikely will be used outside of it, same as in the perform()

@openjdk
Copy link

@openjdk openjdk bot commented Jan 12, 2021

⚠️ @azuev-java This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

+ (JavaComponentAccessibility *) getComponentAccessibility:(NSString *)role
{
if (rolesMap == nil) {
[self initializeRolesMap];

This comment has been minimized.

@mrserb

mrserb Jan 14, 2021
Member

Is it possible that this will be called on the different threads? Or it is always appkit(probably AWT_ASSERT_APPKIT_THREAD could be useful)?

This comment has been minimized.

@azuev-java

azuev-java Jan 14, 2021
Author Member

Well, this method is being called from AppKit thread only but giving that it is static and public adding an assertion would be indeed wise. Fixed.

@mrserb
mrserb approved these changes Jan 14, 2021
@azuev-java
Copy link
Member Author

@azuev-java azuev-java commented Jan 14, 2021

/integrate

@openjdk openjdk bot closed this Jan 14, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jan 14, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jan 14, 2021

@azuev-java Since your change was applied there have been 54 commits pushed to the master branch:

  • 5513f98: 8258010: Debug build failure with clang-10 due to -Wdeprecated-copy
  • 51e14f2: Merge
  • 5926d75: 8259719: ProblemList runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java on Windows
  • 8abefde: 8259720: ProblemList java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.java on Windows
  • fb8ac24: 8259722: ProblemList two jdk/jfr/startupargs tests on Windows
  • ac4cd2e: 8231461: static/instance overload leads to 'unexpected static method found in unbound lookup' when resolving method reference
  • 42d2d6d: 8259063: Possible deadlock with vtable/itable creation vs concurrent class unloading
  • 6bb6093: 8259657: typo in generated HELP page prevents localization
  • 5567530: 8258272: LoadVectorMaskedNode can't be replaced by zero con
  • a99df45: 8259560: Zero m68k: "static assertion failed: align" after JDK-8252049
  • ... and 44 more: https://git.openjdk.java.net/jdk/compare/77f6290995dc681c55301fd032f642057523094a...master

Your commit was automatically rebased without conflicts.

Pushed as commit ae9187d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@azuev-java azuev-java deleted the azuev-java:JDK-8256109 branch Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants