Skip to content

Commit fee20ba

Browse files
author
Daniel Marjamäki
committed
Java: Removed bailout added in 120073f
1 parent 995e392 commit fee20ba

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

lib/checkclass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ void CheckClass::SpaceInfo::getVarList()
745745
}
746746

747747
// If the vartok was set in the if-blocks above, create a entry for this variable..
748-
if (vartok && vartok->str() != "operator" && !Token::Match(vartok->next(), "; %varid% =", vartok->varId()))
748+
if (vartok && vartok->str() != "operator")
749749
{
750750
if (vartok->varId() == 0 && check->_settings->debugwarnings)
751751
{

test/testclass.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,12 +2244,30 @@ class TestClass : public TestFixture
22442244
ASSERT_EQUALS("", errout.str());
22452245
}
22462246

2247+
void checkUninitVarJava(const char code[])
2248+
{
2249+
// Tokenize..
2250+
Tokenizer tokenizer;
2251+
std::istringstream istr(code);
2252+
tokenizer.tokenize(istr, "test.java");
2253+
tokenizer.simplifyTokenList();
2254+
2255+
// Clear the error log
2256+
errout.str("");
2257+
2258+
// Check..
2259+
Settings settings;
2260+
settings._checkCodingStyle = true;
2261+
CheckClass checkClass(&tokenizer, &settings, this);
2262+
checkClass.constructors();
2263+
}
2264+
22472265
void uninitJava()
22482266
{
2249-
checkUninitVar("class A {\n"
2250-
" private: int i = 0;\n"
2251-
" public: A() { }\n"
2252-
"};");
2267+
checkUninitVarJava("class A {\n"
2268+
" private: int i = 0;\n"
2269+
" public: A() { }\n"
2270+
"};");
22532271
ASSERT_EQUALS("", errout.str());
22542272
}
22552273

0 commit comments

Comments
 (0)