tmysik commented on code in PR #8142: URL: https://github.com/apache/netbeans/pull/8142#discussion_r1912384223
########## php/php.project/src/org/netbeans/modules/php/project/ComputeTestMethodAnnotations.java: ########## @@ -0,0 +1,190 @@ +/* + * 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.netbeans.modules.php.project; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.JTextComponent; +import org.netbeans.api.editor.EditorRegistry; +import org.netbeans.modules.editor.NbEditorUtilities; +import org.netbeans.modules.gsf.testrunner.ui.api.TestMethodController; +import org.netbeans.modules.gsf.testrunner.ui.api.TestMethodController.TestMethod; +import org.netbeans.modules.php.api.editor.EditorSupport; +import org.netbeans.modules.php.api.editor.PhpClass; +import org.netbeans.modules.php.api.editor.PhpType; +import org.netbeans.modules.php.api.phpmodule.PhpModule; +import org.netbeans.modules.php.api.util.FileUtils; +import org.netbeans.modules.php.project.ui.actions.support.CommandUtils; +import org.netbeans.modules.php.project.util.PhpProjectUtils; +import org.netbeans.modules.php.spi.testing.PhpTestingProvider; +import org.netbeans.spi.project.SingleMethod; +import org.openide.filesystems.FileObject; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.RequestProcessor; + + +public class ComputeTestMethodAnnotations implements DocumentListener, PropertyChangeListener, Runnable { Review Comment: This class is supposed to be a singleton, but its threading is wrong. It does not use any synchronization so even the `instance` field is not created and handled correctly. Also, I am not sure, whether the implementation itself is correct, but based on your detailed PR description, it could be 😄 But please, let @junichi11 verify and approve it. If I get it right, we simply add a listener to the last focused document and handle its updates. No matter what, the threading of this class must be fixed. Thank you for your work. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
