Why debug can not step into/force step into Continuation.yield(ContinuationScope) method - java-19

question occur in OpenJDK 19 when debugging in VirtualThread.yieldContinuation().
At 370 line, i can not step into or force step into the method Continuation.yield(VTHREAD_SCOPE)
...
try {
return Continuation.yield(VTHREAD_SCOPE); //line 370
} finally {
...
}
How can i enter the method ?

Related

How to use expectOutputString PHPunits?

this my first question.
I install composer (1.10.5), fatfree-core(3.7) and phpunit (9.1.3) and go to TDD.
All working, but if i use $this->expectOutputString();
I've Assertions: 0 - not working.
I found it's:
> $f3 = Base::instance();
>
> $f3 -> mock ('GET /'); // <= it is problem
<?php
[...]
protected function setUp (): void
{
$this->f3 = Base::instance ();
$this->f3 -> set ('QUIET',TRUE);
$this->f3 -> config ('config.ini');
$this->f3 -> mock ('GET /ftp');
$this -> MainController = new MainController ($this->f3);
}
public function testExpectFooActualFoo ()
{
$this->expectOutputString ('foo');
print'foo';
}
[...]
CMD:
#php ./vendor/phpunit/phpunit/phpunit tests/MainControllerNoStaticTest.php
PHPUnit 9.1.3 by Sebastian Bergmann and contributors.
fooR
1 / 1 (100%)
Time: 00:00.052, Memory: 4.00 MB
There was 1 risky test:
1) MainControllerNoStaticTest::testExpectFooActualFoo
Test code or tested code did not (only) close its own output buffers
OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Risky: 1.
Base heve finall class, before I mocked myself i edit base core and delete finall, but now this not good idea. Base (fat-free) have mock option.
Do you have an idea how to get it to be good?
- without modifying fat-free and phpunit files?
I want to use phpunit for testing, and I put the programming environment on fat-free.
Use getActualOutputForAssertion() to get the output and then use regular assertions on its return value. This will not help you, though, with misbehaving code under test that does not (only) close its own output buffers.

PhpStorm with PHPUnit 8.4 gives exception Uncaught PHPUnit\Runner\Exception class ... could not be found

I tried to use PHPUnit v8. However I was not succeeded with PhpStorm. When I run simple test (class method) in PhpStorm I got the following message:
PHP Fatal error: Uncaught PHPUnit\Runner\Exception: Class 'Mrself\\TreeType\\Tests\\Functional\\BuildingTest' could not be found in '/vagrant/symfony-tree-type/tests/Functional/BuildingTest.php'. in /vagrant/symfony-tree-type/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php:65
Yes, I have that class and yes I have psr configured properly:
"autoload": {
"psr-4": {
"Mrself\\TreeType\\": "./src/"
}
},
"autoload-dev": {
"psr-4": {
"Mrself\\TreeType\\Tests\\": "./tests/"
}
}
The proof the I have everything correctly setup is that when I run vendor/bin/phpunit it gives me correct result.
When I run method in PhpStorm I got the following call:
/usr/bin/php /vagrant/symfony-tree-type/vendor/phpunit/phpunit/phpunit --configuration /vagrant/symfony-tree-type/phpunit.xml --filter "/(::testFormCanBeBuild)( .*)?$/" Mrself\\TreeType\\Tests\\Functional\\BuildingTest /vagrant/symfony-tree-type/tests/Functional/BuildingTest.php --teamcity
However if I prepend class namespace with \\ everything works correctly as well. I can not get a clue what's going on. PHPUnit version 7 works as well.
Same thing happened to me. All of the sudden I started getting the following error:
PHP Fatal error: Uncaught PHPUnit\Runner\Exception: Class 'Tests\\Feature\\ExampleTest' could not be found
And after I have read #frank-vue's comment I noticed the same thing and he did: If I run tests on the entire folder it runs normally, but if I run test on a specific class/method I get that error.
I tried earlier version of PHPStorm, downgraded PHP plugin etc... and nothing worked.
In my case, when I checked the stacktrace looks like:
#0 /var/www/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(145): PHPUnit\Runner\StandardTestSuiteLoader->load('Tests\\\\Unit\\\\Ex...', '/var/www/tests/...')
#1 /var/www/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(105): PHPUnit\Runner\BaseTestRunner->loadSuiteClass('Tests\\\\Unit\\\\Ex...', '/var/www/tests/...')
#2 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(177): PHPUnit\Runner\BaseTestRunner->getTest('Tests\\\\Unit\\\\Ex...', '/var/www/tests/...', Array)
#3 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(159): PHPUnit\TextUI\Command->run(Array, true)
#4 /var/www/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#5 {main}
thrown in /var/www/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php on line 69
Notice Tests\\\\Unit\\\\Ex... instead of Tests\\Unit\\Ex....
So in the end I broke the rule and I've modified vendor file, which should be avoided at any cost, but as a temporary solution it solves my problem.
So I added 1 line to the vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php on line 98 (PHPUnit version 8.4.1), which replaces unnecessary '\'s.
if (empty($suiteClassFile) && \is_dir($suiteClassName) && !\is_file($suiteClassName . '.php')) {
/** #var string[] $files */
$files = (new FileIteratorFacade)->getFilesAsArray(
$suiteClassName,
$suffixes
);
$suite = new TestSuite($suiteClassName);
$suite->addTestFiles($files);
return $suite;
}
$suiteClassName = str_replace('\\\\', '\\', $suiteClassName); // THIS IS THE LINE I ADDED
try {
$testClass = $this->loadSuiteClass(
$suiteClassName,
$suiteClassFile
);
} catch (Exception $e) {
$this->runFailed($e->getMessage());
return null;
}

Perl 6 error: Malformed UTF-8

right now, I'm learning Perl 6; my first project is to make an HTTP client .. I get an error and I do not understand why
Malformed UTF-8 at line 1 col 45
in method new at main.p6 line 13
in block <unit> at main.p6 line 43
I think it comes from the port variable, but I'm not sure
Here is all of my perl6 code:
class Request
{
has $!method;
has $!path;
has $!version;
has #!headers;
has $!socket;
has $.response is rw;
method new(:$method, :$path, :$host, :$port, :$version = "HTTP/1.1")
{
my $socket = IO::Socket::INET.new(:$host, :$port);
return self.bless(:$method, :$path, :$version, :$socket);
}
submethod BUILD(:$!method, :$!path, :$!version, :$!socket){}
method setHeader($name, $value)
{
my %header = name => $name, value => $value;
#!headers.push({%header});
}
method toString
{
my $request = "$!method $!path $!version\r\n";
for #!headers -> %_ {
$request ~= %_{'name'} ~ ": " ~ %_{'value'} ~ "\r\n";
}
$request ~ "\r\n";
}
method send($i = 1)
{
say "Request send!";
$!socket.print($.toString());
say $!socket.recv for 0..$i;
}
}
my $host = "127.0.0.1";
my Int $port = 58002;
my $request = Request.new(:method("GET"), :path("/"), :$host, :$port);
$request.setHeader("host", $host);
$request.setHeader("Accept-Language", "fr");
$request.send(2);
This answer may not be helpful, might be annoying, but I can delete it later today if it was and it's all I've got and I have to run.
I don't know if you understand the error message, but let's cover that first.
Malformed UTF-8 at line 1 col 45
in method new at main.p6 line 13
in block <unit> at main.p6 line 43
This means that during execution of the last line in the message, line 43 of your code, something went wrong:
my $request = Request.new(:method("GET"), :path("/"), :$host, :$port);
The compiler noticed that execution of that last line involved a path that went through another line in your code, line 13:
return self.bless(:$method, :$path, :$version, :$socket);
So that helps better pinpoint the line during execution of which the error occurred.
.bless is a method call. It's called on self which refers to the invocant passed to the method which you can assume is an object of the class in which the method call appears, namely the class you're defining Request.
Your code doesn't specify what class Request inherits from (using is) so it inherits from Any. The bless for Any is inherited from Mu's.
which is this code in the Rakudo compiler:
method bless(*%attrinit) {
nqp::create(self).BUILDALL(Empty, %attrinit);
}
So during execution of that code, Perl 6 attempted to read some UTF8 and encountered an invalid character at col 45 of the very first line of some data it tried to read.
So that's the best I can say about why, without seeing your data.

Vtiger 6.5 error after installatiion

I've just installed Vtiger 6.5 on windows xampp server, the installation went smoothly but as soon as I started the browser (localhost/vtigercrm) I get this error.
Fatal error: Cannot unset $this in C:\xampp\htdocs\vtigercrm\libraries\adodb\adodb-xmlschema.inc.php on line 160
Does anyone know what I've done wrong? I've downloaded and tried it several times, I've also changed the php.ini file according to the manual but doesn't seem to have an effect.
This issue seems to occur when we try to install vTiger6.5 in PHP 7. For me the vTiger6.5 got successfully installed after commenting the line number 160 and 2214.
Comment the Line number 160 and 2214 in the file vtigercrm\libraries\adodb\adodb-xmlschema.inc.php.
unset( $this ); /* comment this line no: 160 and 2214 */
This error may occurs in PHP 7 version. So proposed solution is below.
Please update that function with this one in file vtigercrm\libraries\adodb\adodb-xmlschema.inc.php on line 160
function Destroy() {
ini_set("magic_quotes_runtime", $this->mgq ); //Add this line
unset( $this );
}
Based on my experience, changing PHP version to 5.6 (or 5.5 or 5.4) will solve your problem. Although Vtiger 6.5 is supposed to be compatible with php 7, in practice it is not.
This error occurs when vtiger 6.5 is installed on the PHP 7 installation. Comment the unset ($ this); in the function Destroy ()
Line 160 function destroy () { // unset ($ this); }
Line 2216 function destroy () { ini_set ("magic_quotes_runtime", $ this-> mgq); #set_magic_quotes_runtime ($ this-> mgq); //unset ($ this); }
Open index.php file in root and add below mentioned code at start of a file
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT);
Open /libraries/adodb/adodb-xmlschema.inc.php file and then
comment line 160
function destroy() {
//ini_set("magic_quotes_runtime", $this->mgq );
//unset( $this );
}
comment line 2214
function Destroy() {
//ini_set("magic_quotes_runtime", $this->mgq );
#set_magic_quotes_runtime( $this->mgq );
//unset( $this );
}
and then give 755 permission to /test folder
sudo chmod -R 755 test/

Crash in QWebView

My application contains a class which inherits QWebView. The problem is that I get a crash every time I try to type something in this view! Here's my code :
void QViewSupport::setupSupport(QWidget * widget)
{
QUrl startURL = QUrl("http://www.google.fr");
load(startURL);
}
So basically whenever I try to type something in the google search bar, it crashes at the first character...
Here's the output :
ASSERTION FAILED: ICU could not open a break iterator:
U_MISSING_RESOURCE_ERROR (2)
U_SUCCESS(openStatus)
c:\work\build\qt5_workdir\w\s\qtwebkit\source\webcore\platform\text\TextBreakIteratorICU.cpp(45) : WebCore::setUpIterator
1 02426EF7
2 018F0F40
3 018F0CA0
4 018F0E1A
5 0207D7D3
6 0207CE91
7 014F1470
8 01CDBBF5
9 013EEEAC
10 013A45BE
11 01392CA7
12 013A4076
13 0134C062
14 0136166A
15 0144F19A
16 014562E3
17 014205E5
18 0141D9A6
19 017DCE6C
20 0134C82C
21 014EA80F
22 014F1525
23 013EEEAC
24 013A45BE
25 01392CA7
26 013A4076
27 0134C062
28 0136166A
29 017DCE25
30 014202C3
31 0100D627
First chance exception at 0x02426ef7 (Qt5WebKitd.dll) in myApp.exe : 0xC0000005: Access violation writing location 0xbbadbeef.
Unhandled exception à 0x02426ef7 (Qt5WebKitd.dll) in myApp.exe : 0xC0000005: Access violation writing location 0xbbadbe
Am I missing something? I searched the Internet and couldn't find something close to this problem. Thanks in advance if you have the solution!
Edit : As asked, here's the class :
class QViewSupport : public QWebView
{
Q_OBJECT
public:
QViewSupport(QWidget *parent);
~QViewSupport();
private:
void setupSupport(QWidget *Form);
};
And in the .cpp file :
#include "qviewsupport.h"
QViewSupport::QViewSupport(QWidget *parent)
: QWebView(parent)
{
setupSupport(this);
}
void QViewSupport::setupSupport(QWidget * widget)
{
QUrl startURL = QUrl("http://www.google.fr");
load(startURL);
}
QViewSupport::~QViewSupport()
{
}
Edit : The call to this function is done in Setup.cpp (see below), and pViewSupport is a private member define in the Setup class : QViewSupport* pViewSupport;.
Setup::Setup(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
}
void Setup::setupUi(QWidget * widget)
{
// plenty of other things
pViewSupport = new QViewSupport(this);
// same
}
Ok, the problem came from the ICU dlls from Qt, I just replaced them and it worked.

Resources