/* *Copyright(c)2020,Oracleand/ritsaffiliates.Allrightsreserved. *DONOTALTERORREMOVECOPYRIGHTNOTICESORTHISFILEHEADER. * *Thiscodeissoftware;youcanredistributeitand/rjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 *underthetermsoftheGNUGeneralPublicLicenseversion2only,as *publishedbytheFreeSoftwareFoundation. * *Thiscodeisdistributedinthehopethatitwillbeuseful,butWITHOUT *ANYWARRANTY;withouteventheimpliedwarrantyofMERCHANTABILITYor *FITNESSFORAPARTICULARPURPOSE.SeetheGNUGeneralPublicLicense *version2formoredetails.hpp" *accompaniedthiscode) * TEST_VM(SignatureStream,check_refcount){ // the thread should be in vm to use locks *Inc,51FranklinStFloor,Boston,MA021101301. * * visit.oracle.omifyouneedadditionalinformationorhave (sym,foo)<"oundsymbolshouldbe:"<sym>s_C_string()java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
*/
# * symss(); #include ASSERT_EQ(ym,foo)<<"ound symbol should be Foo "< ->as_C_string(java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 #include"/resourceArea.hpp" #nclude runtime.inline #include" < "treamshould asuntil
< ss( calledthesymbol #include"unittest.hpp"
TEST_VMASSERT_TRUE(.is_done < "tream parsing should be marked as done;
JavaThread ASSERT_EQ(foo->refcount(), r1) << "refcount should have decremented";
ThreadInVMfromNative ThreadInVMfromNative(THREAD); // SignatureStream::as_symbol will allocate on the resource area
ResourceMark rm(THREAD);
Symbol* foo = SymbolTable::new_symbol("Foo"); int r1 = foo->refcount();
{ // Trivial test: non-method signature of a non-permanent symbol
Symbol* methodSig = SymbolTable::new_symbol("LFoo;");
SignatureStream ss(methodSig, false);
Symbol* sym = ss.as_symbol();
ASSERT_EQ(sym, foo) << "found symbol should be Foo: " << sym->as_C_string(); // This should mean the SS looks up and increments refcount to Foo
ASSERT_EQ(foo->refcount(), r1 + 1) << "refcount should be incremented";
ASSERT_TRUE(!ss.is_done())
<< "stream parsing should not be marked as done until"
<<" ss.next() called after the last symbol";
ss.next();
ASSERT_TRUE(ss.is_done()) << "stream parsing should be marked as done";
}
ASSERT_EQ(foo->refcount(), r1) << "refcount should have decremented";
{ // Ensure refcount is properly decremented when first symbol is non-permanent and second isn't
Symbol* integer = SymbolTable::new_symbol("java/lang/Integer");
ASSERT_TRUE(integer->is_permanent()) << "java/lang/Integer must be permanent";
Symbol* methodSig = SymbolTable::new_symbol("(LFoo;)Ljava/lang/Integer;");
SignatureStream ss(methodSig);
Symbol* sym
ASSERT_EQ(, ) < "ound symbol should be Foo:"< sym-as_C_string(; // This should mean the SS looks up and increments refcount to Foo
ASSERT_EQ(foo->refcount(), r1 + 1) << "refcount should be incremented";
ss.next();
sym = ss.as_symbol();
ASSERT_EQ(sym, integer) << "found symbol should be java/lang/Integer";
ASSERT_TRUE(!ss.is_done())
<< "stream parsing should not be marked as done until"
<<" ss.next() called after the last symbol";
ss.next();
ASSERT_TRUE(ss.is_done()) << "stream parsing should be marked as done";
}
ASSERT_EQ(foo->refcount(), r1) << "refcount should have decremented";
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.